The oxidation number of an element allows use to put a number on the "state" of that element. The "state" is what level of oxidation or reduction that the element is in. It is more for helping characterize and identify redox couples and doing electron accounting work than it is about actual charges on elements. Typically, when an element is bound to other elements with covalent bonds the individual elements are not actually ions at all - after all, the bonds are covalent and the bonding electrons are shared. We still go in though and assign oxidation numbers as if every element either gets all the electrons in the bond or none. It is account work and rules apply.
Rule #1 (the most important one)
All the oxidation numbers in an atomic or molecular species must sum to equal the overall charge of the species. This means neutral species have to have all the oxidation numbers add up to zero. Anions will have the totals end up negative while cations end up with positive totals. This number one rule helps us figure out hundreds of oxidation states by just memorizing a few.
and the rest...
- The oxidation number of an atom in its neutral elemental state is zero. This is true of neutral monatomic species as well as polyatomic neutral elements. For example, what is the oxidation number of oxygen in oxygen gas, O2? Zero. How 'bout ozone, O3? zero. Iron, Fe? zero. Chlorine gas, Cl2? zero.
- The oxidation number for a monatomic ion is equal to its charge. So a Mg2+(aq) ion has an oxidation number of +2, while a bromide ion, Br− is −1.
- This is like the previous rule except that sometimes ions are together as a simple ionic compound (a salt). Assign the oxidation number to match the charge on each monatomic ion. What is the oxidation state of Mg and Br in magnesium bromide, MgBr2? Mg is +2, and Br is −1.
- Oxygen is given the oxidation number of −2 when combined with other elements. What is the oxidation number of O in H2O? −2. What is oxygen in carbon dioxide, CO2? −2 on each of them, which also means the C has to be a +4 because of rule #1.
- There is a rare case when an oxygen is with another oxygen as the anion, peroxide, O22−. This forces the oxidation number to be a −1 for both oxygens so that the total is −2 and the oxygens are equivalent. There aren't a lot of peroxides in the world, but watch out for them. The most common one is hydrogen peroxide, H2O2. The oxygens are both −1's and the hydrogens are +1's.
- In most compounds, hydrogen is given the oxidation number of +1. The exception is when it is bonded to a metal in which case it is −1 and is called a hydride. What is the oxidation state of H in methane, CH4? +1. What is the oxidation state of H in H2SO4? +1. In LiH? −1. In H2? 0.
- Once you apply the above rules, all the other elements are determined (calculated) via big Rule #1.