The moon is one four-hundredth the size of the sun, but by luck—or a gift of the cosmos—the moon is one four-hundredth as far from Earth as the sun is. The moon and the bright disk of the sun are about the same size in Earth's sky, so when the alignment is right, the moon can hide the sun from view.
A total solar eclipse happens when Earth, the moon, and the sun are in exact alignment and the moon casts a shadow on the Earth's surface. The three bodies are in the right order every month, with each new moon, but most often the moon passes "above" or "below" the sun (as seen from Earth) and no shadow hits the planet's surface. The moon's orbit is tilted about five degrees relative to the plane of Earth's orbit around the sun; only when all three bodies are in the right order and in the same plane is there an eclipse.
Earth is a big place and the shadow the moon casts during an eclipse is very narrow. To see the eclipse, an observer on Earth must be in line with both the sun and the moon. From space—or from the near side of the moon—you would see a small dark shadow, the umbra, moving slowly across Earth. A fainter but larger shadow called the penumbra encircles the umbra. An observer in the penumbra sees a partial eclipse, not a total eclipse.
The duration of an eclipse depends on your location in the shadow—it's longer if you are in the middle of the shadow and shorter at the edge—and on the distance between the moon and Earth. Under the best conditions, an eclipse can last more than seven minutes.