Pairing is not a matter of cancellation, as you guessed. For instance in O
2, two electrons stay unpaired on two orbitals, as this is more favourable by 94kJ/mol than pairing both electrons on a single orbital.
It's more that, when two atoms interact because they're close to an other, half of the new orbitals (bonding) offer a lower energy and the other half (antibonding) a higher one. Because two paired electrons (opposite spins) can fill the same orbital, they may both fill the bonding one, so the result of the atoms' interaction is to lower the energy.
This depends on how many electrons are brought by the atoms, as compared with how many bonding orbitals are created. For N
2 the numbers fit perfectly, so the bonds are strong and the molecule inert. O
2 has 2 electrons more which find only antibonding orbitals, so the molecule is more reactive, and F
2 even more.
https://en.wikipedia.org/wiki/Triplet_oxygens
2 p
6 configurations seem especially favourable, with the next d shell always at a much higher energy, but I ignore why. Noble gases (except He) have this configuration, while other shells keep reactive when full. Maybe this relates with the octet rule.