Spectroscopy Adding energy to a large collection of atoms will excite a large number of electrons. Some of the excited electrons will jump to higher energy states. Later, they will jump back down to the ground state. When they jump back down, they give off electromagnetic radiation. If the radiation is in the visible range, then the atoms will glow.
Some common examples are mercury or sodium lights.
Mercury gives off a bluish-white color. Sodium gives off a yellow color. The atmosphere of the moon is sodium. The atoms of different elements give off different spectra. This is the basis of many ways to identify the presence of different elements.