Before we talk about the levels tool, we have to talk about histograms. A photo's histogram shows the number of pixels at a given brightness. It represents the distribution of pixels in the photo from light to dark.
If the histogram is bunched towards the left the image is going to look dark. If the histogram is really slammed up against the left side, a lot of pixels in your photo are showing up as 100% black and you've lost detail in the image. This means the exposure is too dark for the camera sensor to distinguish details in the shadows.
Our dog Maeby was kind of enough to pose for some example photos. This photo I under-exposed by two stops.
This next photo I over-exposed by two stops.
This last photo was exposed according to the light meter.
You can view a photo's histogram in your image editing program, or it's actually available on the LCD display of your camera as well. On Canon cameras, if you press the info button a couple times it will cycle to a view that shows you both the image and the histogram.
This is a really great tool to have built into your camera! It let's you get a quick idea of what the exposure was like--whether it was improperly exposed, or whether your scene exceeds the dynamic range of your camera (take a shot from inside your house through a window and you'll run into this problem--too dark inside, too light outside).
The concept of the camera sensor losing detail in shadows and highlights refers to the camera's limited "dynamic range", the range that it can distinguish between dark and light areas in a frame. Dynamic range is another photography term you'll hear thrown around a lot, especially with regards to "High Dynamic Range" (HDR) photography, a fun subject for another post.
The Levels and Curves tools allow you to manipulate your photo's histogram in your image editor. In particular, the Levels tool allows you to stretch your histogram to increase contrast and extend the dynamic range of the photo. I'll cover the levels tool in part 2; I think that's enough for now!
Further Reading -- i.e., better articles ;)
Cambridge In Colour