An atom is the basic building block of all matter. It contains a nucleus with protons and usually neutrons with an electron shell or cloud that contains electrons that try to stay stabilized. The electrons that surround the nucleus sometimes become excited and jump to a higher orbit. This is what produces a photon of light.
An atom’s tiny motion causes the basis for black body radiation. The hotter the object, the more radiation it emits. Hot objects emit short wave radiation and cool objects emit long wave radiation. Each atom has its own specific characteristic wavelengths to which it emits radiation. This radiation is seen as a spectrum. Each atom has its own spectrum. If the light from an object passes through a low density gas, you see an absorption spectrum. If the light source is a low density gas that is excited, you see an emission spectrum. If the light source is a dense material that is emitting light, you see a continuous spectrum. These are all Kirchhoff’s laws.
Astronomers know that hot stars are blue and cool stars are red because of the spectra that they emit. Longer wavelengths emit less energy and hence a cooler temperature and vice versa. As an object approaches an observer, the waves of that light source are being compressed, causing blueshift. When it is moving away from an observer, it is receding and redshifting. The Doppler effect enables astronomers to determine how fast these objects are moving in relation to the Earth – either away or toward the planet.