Although this can be a complex subject, there is a simple way to conceptualize it. It's a way to tweak notes, away from the "natural" tuning based on the overtones of a single root note, in order to make a wide range of key changes possible.
There is a way to derive a usable scale from simple mathematical ratios between the wavelengths of notes --which is easier to visualize if we translate it into the lengths of strings. An octave is half the string length of the original note. A fifth is two-thirds the length of the starting note. These are the places a string naturally resonates, generating what is called the "overtone series." By translating twelve of these tones into a single octave, we can derive something close to our familiar twelve-tone scale. These notes tend to harmonize well together because of that resonance.
You can't do much in the way of key changes in this tuning however, because it is tied to a specific root note, and the different "half steps" and "whole steps" are not of equal sizes. Thus, if you modulated from C to D on a keyboard tuned this way, the song would sound entirely different. There are many different "tempering" systems to adjust for this, but the only one in common modern use is "equal" tempering. In this tuning, only the octaves are tuned to the natural mathematical ratio. All other notes are spaced out equally between them, twelve equal-sized half-steps per octave. This makes each key sound the same as each other, relatively speaking. Some notes, like the fifths, are very close to what they "should" be, others, like the thirds, are pretty far distant. But they are all at least a little bit off from their natural versions, except the octave (and none of them, except the octave, is a simple mathematical ratio).
Interestingly enough, there is some reason to believe that, although most people, particularly without a trained ear, don't consciously perceive the difference between the tempered notes and the naturally tuned ones, there is some subconscious resistance to the artificiality of the tempered sound.