In a redox reaction it can be hard (if it isnt ionic, etc) to tell what species has been reduced and which has been oxidised. Oxidation numbers were devised to assist in determining this.
There are a set of rules that help determine what the oxidation number of an element/compound should be. for example;
1) Elements have an oxidation state of zero. (ie, no electros have been lost or gained).
2) In compounds, the sum of oxidation states is equal to the valency, which is equal to the oxidation state of the compound.
3) Some elements have fixed oxidation states;
ie
Group 1 = +1
Group 2 = +2
Oxygen (usually) = -2
Hydrogen = +1 (mostly; not in metal hydrides)
From these rules the variation in oxidation states for other elements can be determined, or whether they are spectating.
With this, it is possible to determine the loss/gain and determine if it is oxidised or reduced.