The first step in learning how to play lead is learning scales. Scales are a pattern of notes in a specific key. Because of this, they can be used to play a rough lead to any song in that key. You can find TABs of different scales at ultimate-guitar.com or some other free music website. You can also find books which have all the scales printed out for you. I would strongly suggest getting a book, especially the Basic Scales for Guitar by David Mead ($7.95 on Amazon.com) because the scales are laid out by type, then key. Another advantage is it gives a crash course in reading TABs, teaches what scales are, and has many other helpful guides. Plus, it's pocket sized, so you can study it anywhere if you're one of those people that wants to commit all the scales to memory.
Once you are armed with your scales, you need to know what key to play. How do you know that? If you're playing with another guitarist, the first chord of the song is the key. So, if the guitarist hits an Am chord, then the key is A. If they hit a Dsus, the key is D. Get it? If you're trying to develop a lead for a song that doesn't have another guitar, look up the sheet music for it online. At the top of most sheets, it will give the key. Now sometimes the key on a piano doesn't perfectly translate to the key on a guitar. If you find yourself in this situation, then play individual notes on one of the bottom two strings (A and E) until you find a note that sounds right. Since most scales use the same basic shape, once you have a starting place, the rest of it will fall into place.
After you practice with the scale as is for a while, you can do a little improvising. Throw in some extra notes, maybe a bend here or there, and you can spice up any scale-based lead. These changes are really dependent on the song being played. Most of them will come from the melody line. You'll probably find them by just listening. If you are playing a scale that has G in it (say first string, third fret) and you hear a note that's a little above that, like an A, you can slide up to that within the scale. You can pick it or bend up to it. After the off note is played, return to the regular scale. The off note may not be on the melody line. It may just be something that sounds good (as long as it doesn't wreck the song). Play around with it until you get the proper scale and off notes to go with it.
And last, just make sure to adjust your tempo correctly for the speed of the song.