Key concepts
Electrons occupy quantized energy levels around a positively charged nucleus. For the first 20 elements, a useful introductory shell pattern is 2, 8, 8, then 2. The outer occupied shell contains valence electrons.
An electron can absorb an appropriate amount of energy and move to a higher level. When it returns to a lower level, the energy difference leaves as a photon. Sufficient energy can remove the electron completely.
Applications and misconceptions
Applications: emission spectra, lasers, flame tests, lighting, semiconductor devices, and chemical bonding.
Model limit: electrons do not travel on rigid planetary tracks. Shell rings here represent allowed energy levels; the probability-cloud view is closer to the quantum description.