The best method is to do it the Nexus way:
1. Unlock bootloader and void your warranty at
Motorola website.
You will need the
ADB/Fastboot drivers, and follow
this instruction to unlock it.
2. Flash
TWRP recovery using fastboot.
The recovery image posted above is unofficial, once it become official you will be able to find it in this
TWRP database, under the code name "titan".
3. Copy
SuperSU.zip to the phone and flash while in TWRP.
If you messed up the phone you can restore the
factory image, make sure you use the correct firmware for your variant, and do not ever flash a firmware made for another phone. Use
this guide to flash the images. You do not need an unlocked bootloader to flash factory images.
Later on if you need to do over the air updates, the safest way is to flash the "system" and "recovery" partition back to original (these partitions are changed when you flashed custom recovery and rooted). Then repeat step 2 and 3 to reroot the phone after the update.
Be warned that it is easier to hardbrick Motorola devices compared to other phones like Nexus. In the past, Moto phones that were downgraded to firmware too old was hardbricked, and there are some security partition like "CID" partition that once corrupted will perma-brick the device.
The process is the same for the Moto X, just using the correct TWRP file and factory image for the specific phone.