Android Rooting will void phone's warranty. We are not responsible for any damage or data loss caused to your phone. Do it on your own risk.
Follow these steps:
Make sure your phone is charged 70% at least.
Back up all your phone data.
1. Head over to HTC Dev website to unlock the bootloader of your HTC One. You need to unlock bootloader on your phone otherwise it is not possible to gain root access. The steps have been described in detail by HTC, and mainly involves the use of fastboot to enter the unlock command and a Token ID and unlock_code.bin file to achieve it.
2. Download TWRP Recovery for your HTC One, and transfer it to the same folder inside which you placed all the adb and fastboot related files, while unlocking the bootloader. Also, rename the recovery file to “twrp” (with an .img extension).
3. Open a command prompt instance in the same folder where you have placed the adb/fastboot and the TWRP recovery image files. If you are using Windows 7 or 8, simply type “cmd” in the Start menu search and press enter. Then navigate to the folder using the cd command.
*For example, if you have the fastboot and TWRP files inside a folder named “android” on your desktop, you can navigate to it by entering cd /Desktop/android. By default, a new command prompt instance always opens up in the user directory of Windows.
4. Put your One in fastboot mode by powering it off, and then press the Power + Volume Down button. From the menu that comes up, navigate to the fastboot option using the volume keys and select it by pressing the Power key. Connect your One to your Desktop or laptop.
*You can make sure whether the handset is detected by your PC or not, by entering fastboot devices in the command prompt window that you opened in the previous step.
5. Now type fastboot flash recovery twrp.img in cmd and wait for fastboot to flash the TWRP recovery on your One. Once the recovery has been flashed, you need to restart your One manually or by entering the fastboot reboot command.
6. Once your One is up and running, download the SuperUser zip and transfer it to the handset. You will now need to reboot your One into Recovery mode and flash the SuperUser zip file from there.
7. Switch off your One, and switch it on in Bootloader mode while holding the Volume Down + Power button. Navigate to the Recovery option and select it by pressing the Power key. Now, TWRP recovery will boot up on your One instead of the stock recovery from HTC. Tap the Install button and then select the SuperUser zip file.
8. Once the zip file has been flashed, select the Reboot System option to reboot your phone.
If you find Super SU or Super User app in your phone's app drawer that means that your phone is rooted!!