I have never rooted the phone and didn't in this process, my HTC One M8 is Vodafone UK and unlocked to all networks. I used a Windows 10 computer for the fastboot stuff. The whole process took around 2 hours including researching things, and I was left with a phone (IMO) better than I had before, as it was a clean installation of Android Marshmallow with no HTC, Vodafone or Sense branding or pre-installed apps.
This is a fairly high level guide, and each step will take some research on the likes of XDA Developers forum, and Android Forums. I take no responsibility for you doing any damage to your phone or others during this process, you follow this at your own risk! I decided to do the below as I had nothing to lose, my phone was as good as a doorstop.
1) Access the recovery menu
- Hold power button and press volume up, this should show you a white recovery screen
2) Enable fastboot
- (For Windows) Install HTC Sync on your PC, then uninstall it
- Install "Minimal ADB and Fastboot tool" on your Windows PC
- Check fastboot works by connecting your phone to your PC via USB and opening the Minimal ADB and Fastboot tool and typing "fastboot devices" (if you see a serial number you know you're connected to your phone)
3) Unlock the bootloader
- I used the long guide (Method 2) on this site
4) Install TWRP via Fastboot
5) Check TWRP is installed on your phone
6) Install Google Play Experience Rom (no root required) via TWRP