You're probably more familiar with Redshift as its talked about quite a bit. When something is moving away from something else, the light that is emitted is predominantly at the red end of the spectrum. Red light wavelengths tend to be more stretched out the further you are from the object.
Blue light wavelengths tend to be closer together. Blueshift light tends to be emitted from objects that are moving closer. By looking at the blue and red shift, we can determine whether the object is coming closer to us such as in the case of the Andromeda Galaxy or moving away from us. By looking at the spectrum of the objects light, it is also possible to determine how far away the object is by the stretched nature of the spectrum. The further away, the more red the lights spectrum has.
In the case of the Andromeda Galaxy, it has been discovered that it moving closer to us, at about 75 miles per second which may seem fast but due to the sheer distance between our galaxy and the Andromeda Galaxy means they won't collide for another four billion years so we are safe
Scientists use spectrographs to look at the colour spectrum of the light from the star to determine the characteristics. Looking at a star's spectrograph can also tell what its made of and the metals that are in the star and therefore estimate its age amongst other things. Blueshift and Redshift doesn't just apply to stars but also galaxies and nebulas, anything that gives light.
It was Edwin Hubble who first discovered and described the redshift phenomena. He discovered that galaxies that are distant had larger redshifts and therefore all the galaxies appearing to move away from all. As we know, it is not the full case as Andromeda galaxy is moving towards us and therefore the galaxy has a blueshift. N.A.S.A.
Red and Blueshifts subject originated from the Doppler Effect, the effect that describes an instrument that is played at the same volume constantly will appear getting loud as it gets closer to an object and quieter as it moves away. The Doppler Effect was a phenomena first described by Christian Doppler.
In addition to sound doppler waves, he also applied the theory to light waves. It was the light doppler effect that led ultimately to the Big Bang Theory that is the theory about the beginning of the universe.
When Edwin Hubble noticed that the galaxies were moving away from us, the big bang theory started to take off. If they were moving away, they should have all been close, very close, as close as a an atomic singularity.