How do oxidation numbers relate to bonding?
Oxidation numbers are related to the polarity of the bond between two atoms.
The basic rule is:
The more electronegative atom gets ALL of the shared electrons.
For example, in CO₂, the more electronegative O atoms get all of the shared electrons. They end up with eight valence electrons each. Since they have each gained two electrons, their oxidation numbers are -2. The C atom has no valence electrons. It has lost four electrons, so its oxidation number is +4. The sum of the oxidation numbers is zero.
The same principle holds for ions.
In SO₄²⁻, the more electronegative O atoms all get the shared pairs to the S atom. This gives them eight valence electrons each, so their oxidation numbers are each -2. The S atom is left with no valence electrons. It has lost six electrons, so its oxidation number is +6. The sum of the oxidation numbers adds up to the overall charge on the ion (-2).