Relativity sneaks in: spin–orbit coupling
Look closely at a spectral line and it often splits into two or more very close components. This fine structure is smaller than the gross structure by a factor of about 10^4, and its origin is relativistic. The dominant piece is spin–orbit coupling: in the electron's own frame the nucleus circles around it, making a current loop and hence a magnetic field; the electron's spin magnetic moment has an energy in that field that depends on whether spin and orbit are aligned or opposed.
The spin–orbit Hamiltonian couples \mathbf{L} and \mathbf{S}; its energy depends on J through \mathbf{L}\cdot\mathbf{S}, which is why levels of the same term but different J split apart.
The fine-structure constant
The size of these splittings is set by one of physics' most celebrated pure numbers, the fine-structure constant \alpha. It measures the strength of the electromagnetic interaction and controls the whole hierarchy of atomic energy scales: gross structure \sim \alpha^2 mc^2, fine structure smaller by another \alpha^2.
The fine-structure constant — dimensionless, so every observer and unit system agrees on it. That fine structure is of order \alpha^2 \approx 5\times10^{-5} of the gross energy is exactly why the splittings are so small.
Dirac's relativistic equation reproduces the full fine-structure formula, and to remarkable precision it depends only on n and J, not on \ell separately. There remains one more famous crack: states like 2S_{1/2} and 2P_{1/2} that Dirac predicts to be exactly degenerate are in fact slightly split — the Lamb shift — a tiny effect that could only be explained by quantum electrodynamics and helped launch the whole quantum-field program.
Hyperfine structure: the nucleus talks back
Zoom in further and each fine-structure level itself splits, about a thousand times more finely still. This hyperfine structure comes from the coupling between the electron's angular momentum \mathbf{J} and the nuclear spin \mathbf{I}: the nucleus has its own tiny magnetic moment, and its interaction with the electrons defines a new total angular momentum \mathbf{F}=\mathbf{J}+\mathbf{I}. It is smaller than fine structure by roughly the mass ratio m_e/m_p \sim 1/2000, because the nuclear magneton is that much smaller than the Bohr magneton.
Atoms in a magnetic field: the Zeeman effect
Put an atom in an external magnetic field and each level splits according to its orientation m_J — the Zeeman effect. This is how physicists measure magnetic fields on the Sun, and how they identified the electron's spin in the first place. In a weak field, where the internal spin–orbit coupling still dominates, the shift is set by the Landé g-factor.
The weak-field (anomalous) Zeeman shift. Each level fans into $2J+1$ equally spaced sublevels; the spacing depends on L, S and J through g_J, so measuring the pattern reveals the term. \mu_B is the Bohr magneton.