The phases of the moon are caused by the relative positions of the
earth, sun, and moon. The moon goes around the earth, on average, in 27 days 7 hours
43 minutes.
The sun always illuminates the half of the moon facing the sun (except
during lunar eclipses, when the moon passes thru the earth's shadow). When the sun
and moon are on opposite sides of the earth, the moon appears "full" to us, a bright,
round disk. When the moon is between the earth and the sun, it appears dark, a "new"
moon. In between, the moon's illuminated surface appears to grow (wax) to full, then
decreases (wanes) to the next new moon.
The edge of the shadow (the terminator) is always curved, being an
oblique view of a circle, giving the moon its familiar crescent shape. Because the
"horns" of the moon at the ends of the crescent are always facing away from the setting
or rising sun, they always point upward in the sky. It is fun to watch for paintings
and pictures which show an "impossible moon" with the horns pointed downwards.
(above information courtesy of NASA http://liftoff.msfc.nasa.gov)