Last month my Nexus 4 encountered the dead of red light issue, and Google sent me an Nexus 5 as an replacement. The first thing for me is to root it and restore all backup from cloud. Here are the steps.
Step 1: Enable USB Debugging
On your Nexus head to Settings -> Developer options, then check the box marked USB debugging, which will allow your Windows PC to issue commands to your device.
If you don’t see the Developer Options section, you’re going to have to go to the About phone section in the Settings menu, scroll to the bottom, and tap on Build number repeatedly until you unlock it.
Step 2: Download CF-Auto-Root to Your Windows PC
We’re going to use Android developer Chainfire’s rooting tool CF-Auto-Root, which will do most of the heavy lifting for us. Take your computer’s web browser to this link and download the .zip file from the bottom of the page.
Extract the .zip file using an extractor like WinZip or WinRar. It’s best to create a new folder for the files you’re going to extract and extract them there.
Step 3: Boot Device into Bootloader Mode
Power down your N5 then boot into bootloader/fastboot mode by holding in the Volume Down and Power key at the same time. You should see a black screen with a picture of the Android mascot on his back.
Step 4: Launch CF-Auto-Root
Connect your device to your PC with a micro USB cable. Now navigate to the folder where you unzipped the CF-Auto-Root file. While within the the folder, hold down the Shift key, right-click, then select Open command window here.
Step 5: Follow the Given Instructions
The command window will guide you the rest of the way. It will first attempt to unlock your bootloader, a necessary step for rooting.
Be warned: if your bootloader is not already unlocked, this process will erase all the data on your device, essentially leaving you with the original factory settings. There will be a confirmation on the screen to let you choose unlock or not if the bootloader is locked.
Once you issue the command, all that’s left to do is sit and watch the magic happen.
Your phone will reboot with a red Android logo. Congratulations and welcome aboard. You are now rooted.