If you’ve ever heard a train or loud vehicle pass by you’ve likely noticed the Doppler effect. You hear a certain pitch as the vehicle approaches you, then the pitch sounds lower as it passes you and moves away. That change in pitch is due to the Doppler effect. As the vehicle is moving toward you, the sound waves it gives off are bunched together a bit. From your perspective the vehicle is moving in the same direction as the sound it makes. The waves are therefore just a bit shorter than they would otherwise be, and shorter wavelengths of sound make a higher pitch. As the vehicle is moving away from you, the opposite occurs. The waves are stretched out a bit from your viewpoint, and so they sound lower.
The same effect occurs with starlight (any light actually, but as an astrophysicist I like starlight). If a star is moving toward us, the light waves it emits are bunched up a bit. We see the light have a slightly shorter wavelength that it would otherwise. If the star moves away from us, then the light waves look longer. Shorter wavelengths mean the light is shifted toward the blue (blue shifted), and longer wavelengths mean the light’s shifted toward the red (red shifted). This effect is not large for (most) stars. It’s color isn’t changed in a way we can see with the naked eye.
So how do we use this effect to measure a star’s speed? Well, suppose you were very familiar with trains, and knew the exact pitch of its whistle. You could recognize a particular train by its whistle. Now suppose the train was moving toward you or away from you. Even with your eyes closed you would know what the train is doing because you would hear the whistle at a pitch higher or lower than it should be. If you have perfect pitch, you could even detect how much the whistle’s pitch is shifted, and calculate how fast the train is moving toward you or away from you.
We can do the same thing with starlight. If you look at all the different colors coming from a star, you will notice certain patterns of light (called bright line and dark line spectra). Those patterns are produced by elements and molecules in the stars atmosphere. We can make those same patterns from elements here on Earth, so we know what color each pattern should be. If those patterns are blue shifted in the starlight, we know the star is moving toward us. If the pattern is red shifted, the star is moving away from us.
This trick is used a lot to measure the speeds of stars and galaxies in the universe. It can also be used to discover hidden stars. In the figure above I’ve plotted the shift of a star over time. You can see that the shift isn’t constant, but rather starts off blue shifted, then becomes red shifted before becoming blue shifted again. In other words the star is not moving at a constant speed, but rather is oscillating towards us and away from us. This means the star must be orbiting another mass. In this case what looks like a single star is actually two, known as a spectroscopic binary.
Sometimes we don’t have to see a star to know that it’s there.