Here's how it works:
* Light waves: Stars emit light, which travels in waves.
* Redshift: When a star moves away from us, the light waves it emits get stretched out. This stretching shifts the light towards the red end of the electromagnetic spectrum.
* Blueshift: Conversely, if a star is moving towards us, the light waves get compressed, shifting the light towards the blue end of the spectrum.
This redshift/blueshift phenomenon is a key tool for astronomers. It allows them to determine the movement of stars and galaxies in the universe and has been instrumental in understanding the expansion of the universe.