To get root:
Unlock your device via
http://htcdev.com
Download the latest TWRP from
http://techerrata.com/browse/twrp2/m7wls
Shut off your device.
Press and hold volume down and then press power. Keep holding volume down until a menu shows on your screen.
Use the volume rocker to select fastboot and press power to select fastboot.
Plug the device into your computer.
If you have the right drivers installed your phone screen will now say: FASTBOOT USB
Using a command prompt, type:
fastboot flash recovery recovery.img
fastboot reboot-bootloader
Your device will reboot. Use the volume rocker to select recovery and press power. You will now boot TWRP.
In TWRP, select reboot -> system. You will be prompted to install SuperSU. Swipe to confirm.
When your device boots you will see a prompt to install the full version of SuperSU. Select to do the TWRP install. Your device will download a file, reboot into TWRP which will automatically install the file, then reboot again.
Congratulations, you are now rooted!