Prerequisites:You need an unlocked Bootloader (see here) and a working adb+fastboot environment.Downloads:P8 Recovery
Chainfire's SuperSu zipStep-by-step:1. Put all the Downloads into a folder and open a terminal in that folder.
2. Reboot into the bootloader via 'adb reboot-bootloader' (all commands without the quotes).
3. Flash the
TWRP custom recovery via 'fastboot flash recovery openrecovery-twrp-2.8.7.0-p8-xxx-xx.img' (replace this with the correct name).
4. Boot into recovery by pressing the Power button and both Vol+ and Vol- during powerup (don't use 'adb reboot recovery'!).
5. Copy the SuperSu ZIP to your internal storage or MicroSD card (If you have trouble connecting to the recovery on Windows, try
Koush's Universal ADB Driver)
6. Select 'Install' in TWRP and pick the SuperSu ZIP in the file picker and then swipe to confirm flash. Reboot and you have root!