A digital sensor is very much like slide film.  Those who have shot slide film in the past can tell you that if you overexpose part of the frame then you get a 'hole' in the frame with no information in it.  With slide film you end up with a clear spot on your slide.. nothing is there.  This is the same with a digital sensor.  It "whites out" a spot on the sensor and no information will be there.  A print would reveal a 'hole' with no ink and nothing more than a piece of the print paper showing through.  So, we don't want to overexpose a scene from a digital camera.

If you shoot raw with a new DSLR there is actually some 'headroom' to recover overexposed areas.  Usually about half a stop, sometimes as much as a full stop.  The amount depends heavily on the camera, the raw processing software, and  the scene you captured.

A very cool feature of almost every modern digital camera is the inclusion of a histogram.  A histogram shows us a graphic representation of the light as it's captured on the sensor.  A histogram is nothing more than a mosaic.  Pretend you divided a sensor both vertically and horizontally.  You're left with a bunch of little tiny squares, each representing part of the sensor.  A histogram is divided into 256 vertical segments placed next to each other horizontally.  Each segment represents a certain exposure level of the frame from 0-255.  The vertical height of each segment represents how many of each tiny square areas there are on the sensor of that exact level of exposure.  Easy, eh?

 

Middle Grey

 

Also, keep in mind that horizontally the 0-255 segments represent approximately 5 stops.  From left to right '0' represents the darkest part of the image, and '255' represents the brightest part.  See how the histogram has a "hump?"  This is a representation of how many tiny squares on the sensor are at each vertical segments exposure level, with the segments stacked side by side.

 

LCD Preview

 

Ideally you'd want your exposure to be so that the right side touches but never goes past the 255 (right side of histogram).  For many practical purposes this isn't feasible, so we say "expose to the right" and what we really mean is to expose as far to the right as possible, while still leaving just a tiny bit of room before the right.  This way we ensure we're not overexposing and subsequently losing any of those tiny squares which are ultimately data.

 

Underexposed

 

This histogram shows underexposure.  See how all the vertical segments are grouped together to the left?  The height of each segment shows how many 'tiny squares' of the sensor are at this exposure level.

 

Overexposed

 

This histogram shows overexposure.  the vertical segments are grouped together all way to and exceeding the right.  Everything touching and exceeding the right is lost image/data.  We can never get this back unless it falls in the very narrow margin of 'headroom' some DSLRs and raw processing software provide.  Never count on headroom for your exposure unless you know your camera and software on a very intimate basis.

 

Correct exposure

 

This histogram shows an ideal exposure.  Nothing is touching the left, and nothing is touching the right.  The segments grouped in the middle are showing most of the tiny squares (data) are in the ideal exposure range.

Expose to the Right.  This is perhaps the most valuable exposure rule for a digital camera.  Everyone should learn this and apply this rule every time they shoot.