Every atom, ion, and molecule has a unique spectral signature. Reflection of their the underlying electron orbital structure. Each orbital corresponds to a particular energy of the orbiting electron. The details are dictated by quantum mechanics. A single electron orbiting the nucleus.
Lowest energy orbital the electron can reside in.
Higher orbits around the nucleus. Come at specific, exact energies. When an electron jumps from a higher to a lower energy orbital, a single photon is emitted with exactly the energy difference between orbitals. No more, no less. When an electron absorbs a photon with exactly the energy needed to jump from a lower to a higher orbital.