We see the moon because it is lit by the sun. We see the moon go through phases because the relative positions of the earth, moon and sun are continuously changing. The diagram below shows the moon being lit up by the sun. The left half of the moon is facing the sun, and so is brightly lit, but the right half is not facing the sun, and so is dark.
If you were to be at position B, and looked at the moon, then you would see exactly half a moon. The left half would be lit up, and the right half would be dark.
If you were at position A, you would be able to see most of the moon, as you would be sort of in between the sun and the moon. You would see all of the left half of the moon, and some of the right half. You would see a gibbous:
If you were at position C, then you would be looking at mostly the dark, unlit part of the moon. You would see just the left edge of the moon, like this:
If you you have a hard time visualing this, take a flashlight and point it at a small ball. Turn the lights out, and look at the ball from different sides.
The moon is traveling around the earth, and so the relationship between the sun, earth and moon is constantly changing. The diagram below shows the moon traveling around the earth. Imagine that you are looking down on the north pole of the earth. In this case, the earth would be rotating counter-clockwise, and the moon would be traveling counter-clockwise around the earth. (The sun is always to the left in this picture.) There are eight spots marked around the orbit of the moon, with a picture of what the moon would look like when viewed from above. It takes about 30 days for the moon to cycle through its phases.
The table below shows the name and a picture for each of the positions the above diagram. (I got the moon pictures from the NASA web site.)
|Position 1||Position 2||Position 3||Position 4|
|New Moon||Waxing Crescent||1st Quarter||Waxing Gibbous|
|Position 5||Position 6||Position 7||Position 8|
|Full Moon||Waning Gibbous||3rd Quarter||Waning Crescent|
There is a great java applet at http://www.astro.wisc.edu/~dolan/java/MoonPhase.html that demonstrates this. It works best when you make the point of view "both."
Another good simulation is from the University of Nebraska-Lincoln: http://astro.unl.edu/naap/lps/animations/lps.html.
There is one major thing the diagram above does not show: the orbits of the moon around the earth and the orbit of the earth around the sun are not parallel. The orbit of the moon is actually tilted about 5 compared to the orbit of the earth. This means that when the moon is at position 5, the sun, earth and moon usually do not line up exactly. This is when there is a full moon. Likewise, at position 1, the sun, moon and earth ususally do not line up exactly, and this is when there is no moon out, called the "new moon" for some reason, and is simply when we are basically looking at the back, unlit side of the moon. The diagram below shows the moon's orbit around the earth, as the earth itself orbits the sun. The orientation of the moon's orbit stays basically constant (ignoring the almost 20 year precession) so the moon can only cross the plane of the earth's orbit at two possible times in the year.
There are times, however, when the sun, earth and moon do all line up exactly, and these are when eclipses occur. Over the course of a year, there are only two times (labeled B and D in the above diagram) when there could be an eclipse. If there is a full moon when the earth is at B or D, then the earth will be exactly in between the sun and moon, and there will be an eclipse. Likewise, if there is a new moon, and the earth is at B or D, then moon will be right in between the earth and the sun, which is a solar eclipse.
The pictures below show a lunar eclipse. (Pictures copyright © 2001 by Bengt Ask. See http://www.df.lth.se/~bengt/lunar_010109.html)
Any one on the earth who could normally see the moon can see a lunar eclipse. If the earth had no atmosphere, then the moon would disappear during a lunar eclipse. (Of course, we wouldn't be around to witness this.) It turns out that the atmosphere acts a little bit like a magnifying glass. Light from the sun traveling through the atmosphere will bend, and so some light does actually still get to the moon. As the light travels through the atmosphere, a lot of the "blue" has been scattered, or filtered, out of it, and so the light that reaches the moon is a reddish orange color. During a lunar eclipse, the moon doesn't disappear altogether, but changes to a dimly lit dull orange red color.
The pictures below show a solar eclipse. (Pictures are from http://www.iayc.org/astropic/)
The moon is a lot smaller than the earth, so its shadow is a lot smaller. during a solar eclipse, only a small region of the earth will actually be in the shadow; most people don't get to see the eclipse. The moon and the sun are about the same size in the sky, and so a "normal" solar eclipse will have the moon completley blocking out the sun, and the region in the shodow on the earth would be "night." However, if the eclipse happens when the moon happens to be at its farthest point from the earth, the sun is actually a little bigger than the moon in the sky, and so the moon only blocks out the middle of the sun. This is called an annular solar eclipse, or a ring eclipse. The region in the shadow would not get totally dark like night, but just dimly lit, like dusk.
The picture to the right was from the solar eclipse of August 11, 1999 taken from the Mir space station. It shows the shadow of the moon on the earth. Note how small the shadow is compared to the size of the earth. (The picture is from NASA.)
The picture to the left was taken from the International Space Station during the solar eclipse of December 4, 2002. The dark smudge on the bottom of the earth is the shadow of the moon on the surface of the earth. The Space Station was over the Indian Ocean when the picture was taken. (The picture is from NASA.)
If you would like more detailed explanations, here are a few good links:http://www.astronomynotes.com/nakedeye/s13.htm Very nice page with a lot more details than I cover here.