Oxidation numbers reflect the gain or loss of electrons by an atom in a compound. They are assigned according to a set of rules, such as hydrogen being +1, oxygen being -2, and the sum of oxidation numbers in a neutral compound being 0. Oxidation numbers track the change in electrons during oxidation-reduction reactions where oxidation is a loss of electrons and reduction is a gain.