Shift your bike's gears into the position furthest from the wheel. This should be the highest gears, on both your chain ring (the sprockets attached to the pedals) and your cassette (the sprockets attached to the drive wheel).
Pedal the bike as you apply lube to the chain. The idea is to apply the lubricant and have the chain move it around to all of the sprockets. If another pair of hands are available, have them shift slowly through the entire gear range while applying a continuous stream of lubricant. Remember that your largest chain ring and largest cassette sprocket will take longer to rotate, so pass through these gears more slowly. Don't be afraid to use too much; you would rather have excess drip-off than end up with one spot on your chain squeaking on every rotation.
After you have applied the lubricant continue to spin the pedal, shifting through all the gears. Many bike lubricants have wax or polymer additives that will fall out of the solution when they encounter friction (i.e. friction caused by bits of dirt). These little chunks of wax will fall off the chain and sprockets (taking the dirt and what have you with them) while you are pedaling. In addition, while pedaling without any load on the bike like this you can hear the chain making contact with the sprockets and can determine if any spots of the chain or individual sprockets may need another application of lubricant.
If you are having chain slippage issues and lubricating didn't solve the problem, check to see if any links on the chain are not hinging properly. This occurred to me recently, and can also be fixed using a chain break tool which I will explain how to do in another guide that I will put up soon! If this is not the case, you may need a new cassette, chain ring or chain. The first two are rather obvious: if your sprocket's teeth are sharpened to points it is time to replace them. If the sprockets look fine, check the chain with a chain checker, or pull your bike mechanic out of your tool bag and make him or her do it!