Hund's rule
/ HOONT (rhymes with 'hoont') /
When you board a bus, you tend to take an empty double seat to yourself before squeezing in next to a stranger. Electrons filling a set of equal-energy orbitals do the same thing. Hund's rule says that within a subshell of orbitals that all have the same energy (the three p, five d, or seven f orbitals), electrons spread out singly — one per orbital, all with parallel spins — before any orbital is forced to take a second, paired electron.
There are really two parts. First, maximise the number of unpaired electrons: fill each of the degenerate orbitals with one electron first. Second, give those single electrons the same spin direction (all "up", say) to maximise the total spin. Only once every orbital in the set has one electron does pairing begin. The reason is energetic: two electrons crammed into one small orbital repel each other strongly (it costs pairing energy), and same-spin electrons in different orbitals also stay further apart on average, lowering repulsion. So nitrogen's 2p3 is three separate up-spin electrons (one in each p orbital), not one paired pair plus a single.
Hund's rule is what gives atoms and ions their magnetism. An atom with unpaired electrons is paramagnetic — drawn into a magnetic field; one with all electrons paired is diamagnetic. It drives the high-spin behaviour of many transition-metal complexes and explains the special stability of half-filled subshells (like Mn2+ with five unpaired d electrons). The honest caveat: in a transition-metal complex Hund's rule competes with the crystal-field splitting — if the splitting is large enough, electrons will pair up in the lower orbitals (low-spin) rather than spread out, so Hund's rule is a tendency that can be overruled by a strong ligand field.
Carbon (2p2) places its two p electrons in different p orbitals with parallel spins, not paired in one — so carbon has two unpaired electrons and is paramagnetic.
Spread out singly first, pair up only when you must.
Hund's rule only ranks the lowest-energy (ground-state) arrangement among orbitals of equal energy. It says nothing about orbitals of different energy, and in a strong ligand field it loses to crystal-field splitting, giving low-spin complexes.