Why frequency differences will not do
Pitch can be stated as a frequency, but treating the difference between two frequencies as the distance between them does not match what listeners hear. Ten hertz low in the range is a conspicuous jump, while the same ten hertz higher up is barely noticeable, because the ear responds to ratios rather than differences. Cents express those ratios logarithmically, so a given value corresponds to the same perceived distance anywhere in the range. This consistency is why cents became the standard whenever intervals are handled numerically.
How the conversion works
An octave is the distance across which frequency doubles, and it is defined as 1200 cents. A semitone is one twelfth of that, hence 100 cents, and stacking twelve semitones returns an octave. Converting cents into a frequency ratio uses powers of two; going the other way takes a logarithm. The conversion lets two intervals in different registers be compared on one scale, so that 20 cents in the bass and 20 cents in the treble count as equivalent distances even though the frequency differences are far apart.
Where it is used in practice
In instrument tuning, deviation from a reference is conventionally quoted in cents. Different tuning systems place individual notes at slightly different heights, and those differences are described in cents as well. Cents also appear whenever people discuss how fine a pitch difference a listener can detect, though such values move with the conditions. Longer notes are easier to compare than short ones, and timbre, register and background noise all matter. A figure in cents therefore means little on its own: the conditions under which it was measured have to accompany it.