Distortion, if you're a guitar player it can be the be-all and end-all of your existence. As an audio engineer your main goal in life may be to eradicate it. Unless, that is, you decide to use it as a tool. Whatever your goal or purpose for distortion is, it will help to understand how it works.
In the audio realm a signal is said to be distorted if it is reproduced in a nonlinear way. That means that the signal coming in is different when it goes out. This doesn't apply to volume level, a compressed signal can still be very linear, it's the waveform we're concerned with here. But how does it change?
The most common form of distortion happens when a waveform is clipped. How this happens is that the device the signal is flowing through runs out of headroom. In an amplifier, let's say it's a tiny one on a chip in a cell phone, you have a small voltage that regulates a big voltage and the big voltage comes out with the same signal that went in, just a lot louder. If there are three volts available to the amplifier and then the input signal, multiplied by the gain, results in an output signal that would be greater than three volts, the amp runs out of gas and just stops at it's max output. So the tops of all the waveforms become flat. The same thing happens on a tape when the medium is maxed out on magnetic flux.
Digital clipping is heard when you run out of bits. You get a loud tick. Most of the time, every precaution is taken to keep digital distortion out of the finished product, although occasionally it's done on purpose to create a jarring effect. Higher bit rate devices allow recording at lower levels while maintaining good fidelity and make it easier to stay away from a digital clip.
What I just recently learned about distortion is that there are two distinct ways it can affect the sound. A device that clips the waveform equally on the positive and negative peaks produces odd numbered harmonics. A device that only clips one side of the waveform, a poorly implemented push-pull output stage for example, produces both odd and even harmonics. Odd harmonics are generally pleasant to listen to, picture a chord with the root, third, fifth and octave. Even numbered harmonics aren't necessarily unpleasant to listen to on their own or in certain arrangements, but now play a chord with the root, second, fourth and fifth. Very different sounding. Not that it's bad, but it's not a happy sound and not one you would use unless you decided to create something appropriate with it.
There are other types of distortion like intermodulation. This type of distortion can happen if you have two wireless instruments on the same frequency. The audio present gets summed and you get new tones appearing. With two sine waves it can be interesting because the new frequencies aren't musically related to the original tones, but with tonally complex signals, like a pair of guitars, every fundamental and overtone get's the treatment and you get an awful mess.
In the digital realm you can get a type of distortion called aliasing. A digital sampling system is only capable of capturing signals at a frequency that is half of the sampling rate. This is called the Nyquist frequency. Any information above this will be reproduced at lower frequencies as a distinct kind of noise. Sometimes it's used for artistic effect, like the low rate vocal sample in Rob Zombie's "Living Dead Girl". Generally though it's an unwanted artifact and filters are put in place to keep it from happening.
Total Harmonic Distortion is a way of quantifying how much distortion is present in a signal. THD is generally higher in speakers than in electronic gear. A good number is less than 1%. Lower than that and it becomes more difficult for the human ear to detect, although audiophiles will argue that point. The ear is less sensitive to distortion at lower frequencies so numbers as high as 10% are considered acceptable for subwoofers. Recently though, live engineers have become aware that distortion in the subs is throwing off lots of harmonics that cause muddiness in the mix. Newer designs have shown that low distortion subs can do a lot for a performance.