Within serious photography circles it's generally accepted that the most critical hardware element of a DSLR or compact system camera is the lens you attach to the front of it. For this reason it pays to invest wisely. Lenses come in all shapes and sizes and many are designed for specific purposes, however the first thing to grasp is how the size of your camera's sensor will affect its stated focal length.
In the days before digital this wasn't an issue as 35mm film SLRs all used the same 24 x 36mm film stock. A standard 50mm prime therefore produced the same field of view regardless of the camera it was mounted to.
In the digital age, however, sensors come in a number of different sizes, which in turn affects the effective focal length of the lens. This is because sensors that are smaller than 35mm only capture a middle portion of the image generated by a lens.
Put simply, they effectively crop out the sides and magnify the middle. This has the effect of increasing the stated focal length of any given lens. The extent to which each type of sensor does this is usually referred to as its ‘crop factor'.
Because full-frame sensors are the same size as 35mm film they will capture images at the stated focal length of a 35mm lens. APS-C sensors are slightly smaller, however, which gives them a crop factor of 1.5x (Nikon, Pentax and Sony) and 1.6x (Canon). Cameras that use Micro Four Thirds sensors (Panasonic and Olympus) are smaller still, which gives them a 2x crop factor.
Thereby a 50mm prime will shoot at 50mm on a full-frame DSLR, but 75mm on an APS-C equipped camera, and 100mm on a Micro Four Thirds model.
Another important consideration when choosing a lens is its maximum aperture. This varies greatly, but as a general rule-of-thumb, lenses with faster maximum apertures, or apertures that remain constant throughout the focal range will be bigger, heavier and more expensive.
The main benefit of having a lens with a faster aperture - say a constant f/2.8 as opposed to f/3.5-5.6 - is that they will allow more light in, enabling you to use faster shutter speeds in low-light situations.
Another benefit of faster lenses is that the higher maximum aperture can be used to create a more limited depth-of-field effect, thereby giving you more artistic control over how much of the image you want to be in focus.
Image Stabilisation is another useful technology that aims to reduce the image-blurring effects of naturally occurring handshake at slower shutter speeds and longer telephoto settings, where handshake is magnified.
Image Stabilisation technology is usually implemented either inside the lens via a group of optics towards the back of the lens that move to ‘correct' any detected handshake (Nikon and Canon), or via sensor-shift technology inside the camera body itself (Sony, Pentax and Olympus).
Each manufacturer has a different name for their take on the technology, but essentially they all share a common goal: to make an extra two to five stops of shutter speed available to help keep images sharper.
When choosing a lens you should also consider what you primarily intend to use it for. If you're looking for a lens that's great for portraiture then a 50mm or 100mm f/1.8 prime could be ideal, whereas if you're looking for a single jack-of-all-trades lens to take travelling then an 18-200mm f/3.5-5.6 superzoom may well be your best bet.
Last but not least, remember that prime lenses tend to offer greater levels of sharpness than zoom lenses as they have been precisely engineered to operate at a fixed focal length, whereas the flexibility offered by a zoom tends to come at the cost of some sharpness.