Posted: June 28, 2014
*Important*: please note that this is a Developer Preview. That means things are still broken, there are bugs, and a number of apps simply won't run on it yet. It has only just been released, so undoubtedly things will improve over time as the official launch nears, but I would NOT recommend putting this on your "daily driver" or your primary/only phone right now (June 2014).
First backup your device. Backup everything that is important to you and store in on your computer. Seriously, do this - everything will be erased in the following guide.
Make sure you have the Android SDK downloaded and unzipped into a folder (we will call it "Android") and have located the "platform-tools" folder within the sdk folder: ~Android/sdk/platform-tools. Note, if you are on a Windows PC, it may be easier to install this much smaller Windows ADB installer - it contains everything you need: adb, fastboot, and drivers. If you are on a Mac you do not have to worry about drivers.
Get the factory image for your device. Unzip and move the contents into the "platform-tools" folder or wherever adb and fastboot are located.
One of the best ways to familiarize yourself with the process is to open the included scripts (flash-all.sh or flash-all.bat) in a text editor and look at the commands. The scripts are easy as you can just type in one command and everything gets installed, but if something goes wrong you need to know what has happened.
Note: I am using a Mac so all commands will start with "./" in terminal. If you are using a Mac, type ./ immediately proceeding any adb or fastboot commands. If you are using windows you can just type the commands without the "./" in front. The adb and fastboot commands that you need to type into terminal or command prompt will be center-justified and in bold.
The following step-by-step guide to flashing Android L developer preview is specifically for the Nexus 5 with the initial release, so if you are using a Nexus 7 (2013) or a subsequent Android L release, you may need to adjust the file names near the end of the guide. Each step will be followed by screenshot(s) demonstrating that step.