VCE Chemistry, I feel, doesn't do this topic justice and it's something that I feel people rote learn, so here's a quick guide on them.
For most people, oxidation numbers are just some random number that you assign to individual atoms to determine if it's a redox reaction and perhaps to check how many electrons there should be on one side of a redox half reaction. There's nothing wrong with that; it's just not a rather insightful view into what exactly these are.
The oxidation state model assigns numbers to atoms in a compound by making one assumption: that all bonds are ionic. Therefore, the oxidation number is the charge the atom would have under these situations.
What do we do about covalent bonds? Well, logically the atom that is more electronegative is assigned the electrons. This is why, for instance, we assign oxygen as -2 almost all the time as oxygen is the second most electronegative element. Similarly, hydrogen is normally +1 as it's near the bottom of the list in terms of electronegativity amongst the non-metals.
Now, as oxidation numbers count electrons as if they were localised on individual atoms, the sum of all oxidation numbers must be equal to the charge of the molecule or ion. See where that rule comes from now? Also, with something like F2, this is an example of a truly equal covalent bond, so the oxidation state model gives each atom one electron, which is to be expected, allowing each atom to retain their own electron for an oxidation state of 0.
Let's look at some examples. Carbon dioxide, for instance, has carbon forming two double bonds to each oxygen. As carbon is less electronegative than each oxygen, we treat the carbon as having lost each electron it contributes to each covalent bond. It makes four bonds, so its oxidation number is +4. Similarly, each oxygen makes two bonds and receives two electrons, so they each have oxidation number -2.
Similarly, something like K4Fe(CN)6, while ghastly, can be analysed by breaking it down. The four potassium atoms written at the front of the molecular formula are cations with charge +1, so they've just lost one electron to put them in the +1 oxidation state. The Fe(CN)6 bit has charge -4. Now, cyanide, the CN group, has a charge of -1. It consists of a carbon-nitrogen triple bond in which the nitrogen atom has a full octet and the carbon atom only has 4 + 3 = 7 electrons in its valence shell (under the covalent bond, not oxidation state model!), so it gains an electron and has a negative charge. Now, the carbon has formed a triple bond to nitrogen, so nitrogen has, under the oxidation state model, gained 3 electrons. Normally carbon would be considered to have lost those 3 electrons, but it has a negative charge, so its oxidation state is +2, not +3. As the sum of oxidation numbers of C and N is now -1, our intuition that each CN anion with a -1 negative charge can be replaced by a generic anion of oxidation number -1 is confirmed. So, we're attaching 6 anions contributing -1 to the overall oxidation number, which is -4. Clearly the iron must have oxidation number +2, and we're done!
This helps explain some anomalies with some elements too. Normally, oxygen is -2. In peroxides, like H2O2 which is better represented as HO-OH, the oxygen-oxygen bond means each oxygen only gains ONE electron from the hydrogen to give an oxidation state of -1. Similarly, OCl-, the hypochlorite ion, has a chlorine in a +1 oxidation state as it's less electronegative than oxygen, whereas OF2 has oxygen in the oxidation state +2 as it's less electronegative than fluorine. Hydrogen, when combined with metals in hydrides like LiAlH4 or NaH, is more electronegative, so it has an oxidation number of -1, not +1. Be warned.
Finally, let's look at one other aspect of oxidation numbers. If you look at propane, C3H8, you'll see that a standard analysis of oxidation numbers gives hydrogen as +1 and carbon as -8/3. Fractional oxidation numbers?
Propane is H3C - CH2 - CH3. The first carbon is bonded to three less electronegative hydrogens, so it has oxidation state -3. The fourth bond is to another carbon, so that bond counts as an equal covalent bond. Same with the third carbon. The second carbon is bonded to two hydrogens and two carbons, so its oxidation state is -2. If we average -3, -3 and -2, we get -8/3. Thus, the oxidation state of the carbon in C3H8 is really just the average of all of the oxidation states of the carbon atoms.