Oxidation number is the hypothetical charge an atom will have if all the bonds were purely ionic. In simpler terms, it is the number of electrons gained or lost during the formation of compounds. In a free state the oxidation number would be zero, say oxygen has an oxidation number of 0 in oxygen gas (O2), etc.
The position in the periodic table may or may not give an idea of the oxidation number of an element. The only consistent trend that is observed is +1 oxidation number for Group I metals and +2 oxidation number for group II metals. Similarly, all the halogens (group 17 elements) have an oxidation number of -1 (except when they form compounds with oxygen or other halogens) and all the noble gases have an oxidation number of 0.
There are a number of elements that can have multiple possible oxidation numbers. For example, oxygen has an oxidation number of 0, -2 and -1 in `O_2, SO_4^(2-), H_2O_2.`