Steps to unlock its boot loader and root Moto X 2nd Gen.
Note: This will reset your phone completely. Make backup.
Boot loader can be unlocked following this link from Motorola itself
After successful unlock, Install the TWRP Recovery. This will replace the default recovery screen in Moto X 2014 and replace it with much better touch supported recovery screen by TWRP.
Detailed and other optional steps can be found here https://twrp.me/motorola/motorolamotox2014.html
Download image from https://dl.twrp.me/victara/ and rename to twrp.img (or don’t rename)
platform-tools directory in your Android SDK installation folder and ensure that there is
adb.exe. Run the following commands in this directory
adb reboot bootloader fastboot flash recovery twrp.img fastboot reboot
Enjoy the rooted Moto X