Whitening agents—such as hydrogen peroxide or carbamide peroxide—work by penetrating through the enamel to get to the discoloured molecules.
The oxygen from the agent reacts with the discoloured molecules, breaking them down.
The darkening of your teeth is a natural process that occurs as you age. Good oral hygiene will help slow the effects, but it can’t be totally avoided. Food and drinks with strong colourings—red wine, coffee, tea—speed up the staining process. Smoking is also a major cause.