I have a htc 816 desire running android 5.0.2 and i have tried many a times to root my device but it always fails. I've unlocked the bootloader and tried kingoroot and towelroot all modes i.e., zip, apk, exe.
Since your bootloader is already unlocked, I'm going to skip that process.
This is going to install Cyanogenmod12, which is a rooted version of Android Lollipop (5). Go ahead and download your version of CM. The link is download.cyanogenmod.org/get/jenkins/129826/cm-12-20151011-NIGHTLY-a5.zip
I would post that as a directly clickable link, but I don't have enough rep.
Now move that downloaded file to a place on your phone, and note its location.
You can head over to TWRP and and find your build. If its not there you can go to this link. It is a direct download link. Then (on your phone) go to Settings>About>find Build Number or Build Version (or something like that) and tap it repeatedly until you get a toast saying that developer options is on. Go to the developer options and find USB Debugging or ADB Debugging and turn that on. Then plug your phone into your computer. If you don't have ADB installed on your computer, install it:
apt-get install adb
For windows, find a download somewhere on the internet. But stay away from the "15 second adb and fastboot installer", that is a virus.
Once ADB is installed, plug in your phone, wait for the device to show up as a connected devices, and open cmd or terminal and type:
adb devices. If it shows up, your good, go on. If you get something saying that adb is not a known command, cd to that directory that adb is installed in.
Also, make sure you have fastboot.
Now, type in
Once the phone is in the bootloader, type
fastboot flash recovery recoveryImgName.img. Once that finishes, reboot your phone. Then type
adb reboot-bootloader. When it boots to the bootloader, find Recovery, and choose it. Use the volume keys to navigate and the power button to choose. Depending on which recovery img you used, find something like 'Install' and navigate to the Cyanogenmod file and install that.
Your phone should be rooted running Android 5!