Finding out how fast and in what direction a stellar object is moving relative
to us involves the Doppler effect and the reading of absorption lines.
The Doppler Effect
The change in pitch you hear when a car speeds by happens because the sounds we
hear are waves like the ripples in a pond. As the source of these waves moves
by, it catches up with the waves it's already sent out, causing them to
"bunch-up" on the leading side of the car and "spread-out" on the trailing
side. This is known as the Doppler effect.
The closer together the waves, the greater their frequency—that is, the more
often they hit our ears. It's the frequency of a sound that allows us to
distinguish between different tones—it's what causes a C to sound different
from an F. We hear the higher frequency as a higher pitch.
The faster a source moves, the more exaggerated the effect. A sound coming from
a faster moving car, for example, will have a higher pitch than the same sound
coming from a slower moving car.