Definition
Have you ever stood on a sidewalk while an ambulance came toward you? Its siren goes "weee-ooo" high and shrill, then the moment it zooms past, the pitch suddenly sinks into a low "wooo-ohh." The Doppler effect is this change: when something that gives off waves, like sound or light, and the person hearing or seeing it move closer together or farther apart, the frequency (how many times a wave vibrates per second) that person detects becomes different from the original.
Why does the sound get higher as it comes closer?
Picture a duck floating still on a lake, paddling its feet. Round ripples spread out evenly in every direction, and the gaps between ripples are the same in front, behind, and to the sides. But once the duck swims forward while it keeps paddling, the ripple pattern changes a lot.
Because the duck moves ahead as it makes ripples, the ripples in front get squeezed tightly together. The ripples behind, where the duck has already been, get spread far apart and loose.
Sound is a kind of ripple, too. It's a wave (a vibration of the air) that travels through the air. When an ambulance races toward you with its siren on, the sound waves bunch up in front of it and hit your ears more often. The more waves that strike your eardrum each second, the more your brain hears a higher pitch.
If the ambulance and the listener were both standing still with the siren on, you wouldn't hear this change at all. The ambulance moves forward and sends out each new wave from a spot closer to the one before it, so the waves in front get closer together (the sound itself doesn't get any faster).
Why the sound drops as it moves away, and what happens to light
Once the ambulance whips past you and heads off into the distance, the exact opposite happens. It's giving off sound while running away at the same time, so the gaps between the sound waves reaching your ears get stretched out like a rubber band.
When the gaps between waves get wider, fewer waves reach your ear each second, so the frequency goes down. Your ear hears a lower frequency as a "low pitch," which is why the siren seems to sink the moment the ambulance goes by.
Amazingly, this Doppler effect doesn't happen only with sound. It happens in a similar way with the light we see. Light is a wave, too. If you split starlight with a prism-like tool (this is called spectroscopy), the pattern of lines in the light (spectral lines) shifts toward the short-wavelength blue end for a star coming toward us (blueshift) and a bit toward the long-wavelength red end for a star moving away (redshift). The star's color doesn't visibly change to your eye.
The radar speed guns that police use to catch speeding cars work on this principle, too. A radio wave is aimed at a car and bounces back, and the gun measures how much its frequency changed (went up or down) to work out the car's speed.
A bit more precisely: the secret of the expanding universe
To be more precise, the siren's actual pitch, or the true color of the light a star gives off, doesn't change at all.
The driver sitting inside the ambulance with the siren on feels no change in pitch. To the driver, it sounds like the exact same note from start to finish. The Doppler effect happens only from the observer's point of view, because of the "relative motion" between the thing making the sound and the person hearing it.
The astronomer Edwin Hubble measured the distances to galaxies and compared them with the redshifts of galaxies that Slipher and others had measured earlier. There are exceptions, like the nearby Andromeda galaxy, which is coming toward us. But a clear pattern showed up: the farther away a galaxy is, the bigger its redshift.
That meant farther galaxies are moving away from us faster, and it became the key evidence for the idea that the universe is expanding, like a balloon being blown up. Keep in mind, though, that the redshift of distant galaxies is explained less as a Doppler effect from galaxies rushing through space, and more as space itself stretching while the light travels.
Common misconceptions
The siren getting louder as an ambulance approaches is the Doppler effect itself.
Hearing it louder is just a volume difference from the ambulance getting closer. The Doppler effect isn't about loudness. It's about the pitch (frequency) of the sound getting sharper and higher or lower.
Where you meet it
When a train blows its horn and speeds past, the horn goes "waaaah~" and then suddenly bends down to a lower note.
The radar speed gun police use to measure a speeding car's speed relies on the Doppler effect of the radio waves bouncing back.
How far the light from distant galaxies is shifted toward red became key evidence for an expanding universe (strictly speaking, it's a redshift caused by space stretching).
Weather radar uses the Doppler effect to track how fast raindrops and storm winds move toward or away from the station.
In one sentence
When a wave source and an observer move closer, the waves get packed together, so sound is heard higher and light shifts toward blue. When they move apart, the waves stretch out, so sound is heard lower and light shifts toward red.