A well-lubricated chain makes shifting smooth and prevents annoying squeaking as you ride. Your local bike store will happily lube your chain for you, but it's easy enough to do at home. All you need is a degreaser, soapy water, natural-bristle brushes and an oil-based lubricant.
Spray or pour degreaser over the chain and clean it with a firm, non-metal brush or clean toothbrush to loosen all the gunk and dirt off your chain, chainrings, cassette and derailleurs. Follow with a quick scrub with soapy water and a natural-bristle brush. Rinse with plain, clean water from a hose. Allow the chain to dry briefly, ideally about five minutes.
Coat the entire chain with bike lubricating oil. If the oil comes with a tipped applicator, use it -- or a cotton swab -- to reach every link and sideplate. Spin the crank in reverse of the normal pedal stroke to thoroughly distribute the oil among the links. Apply lubricant lightly to the cogs as well. Wipe off any excess lubricant so your chain and cogs have only a light layer of oil remaining.
Lubricate your chain whenever your shifters feel a little stiff or the chain squeaks. You should also lubricate the chain after a wet ride to deter rust. Seek out a lubricant made specifically for bikes; non-specific lubricants may not be effective enough, so ask your local bike shop staff what they recommend for the particular conditions in which you ride. Apply a lubricating oil, rather than a grease, which can be too heavy for the chain. Every few months, remove your entire chain with a chain rivet tool so you can clean it more thoroughly and re-oil it completely.