Simply put, the sidechain of a compressor is a detection circuit used to trigger the compression. In most cases, the signal used to trigger the compressor is the same signal being processed. But some compressors offer several interesting options for the sidechain circuit.
One of the most common is the use of high-pass and low-pass filters that can be applied to the detection signal. This comes in extremely handy to target the compressor and make it more sensitive to a specific frequency range. For example, it's not unusual to filter out the lows of the drums in the sidechain. The energy in the low end of a bass drum tends to easily trigger the compressor on the drum track, which results in the rest of the signal being overcompressed. If you filter the sidechain adequately, the compressor won't react so violently to the kick drum, making the overall result more transparent.
Follow the leader
Another option sometimes available is the possibility to use a different signal to the one being processed to trigger the compressor. This is called an external sidechain. At first glance, the idea of compressing an instrument according to the dynamics of another one might seem preposterous. However, the practical applications of this technique are very interesting, not only regarding mixing itself, but also from a creative point of view.
In terms of mixing, for instance, it can prove very useful to carefully adjust the relation between the bass guitar and the kick drum and make them work together. Assume you use a compressor on the bass line, controlled by the kick drum. The level of the bass will decrease automatically with every hit of the kick, making some room for the latter. And, whenever there's no kick, the bass will occupy its place comfortably. That way, these two instruments, which have the annoying tendency of fighting over the low end of the spectrum, will be able to coexist in harmony. This trick isn't limited only to bass and kick, of course. You could also use the external sidechain with vocals and a guitar that struggle lo live together, or with the lead and rhythm guitar, for instance. But be careful, though, don't use extreme settings when you employ the compressor this way, in order for the result to be as natural as possible. Once again, subtlety is the key word here.
You can even use the external sidechain as a creative tool. The most common example is the use of a synth pad that doesn't have any dynamics. By processing this pad with a compressor whose sidechain is fed by a rhythmic element with lots of dynamics, like the kick, you'll get a sound that is much more lively since it breathes at the same rhythm as the song in terms of volume.
Finally, it's very common to use an external sidechain on the effects return. Take, for instance, the case of a particularly dense reverb and a vocal track. This reverb might be wonderful at the end of phrases but, unfortunately, it might also have a tendency to drown the vocals during the phrases themselves. How can you preserve the intelligibility of the text while profiting from this superb effect at the right moments? As you have surely guessed, it's enough to place a compressor on the effects track, right after the reverb, and to control it with the vocals only. When the vocalist is singing, the compressor will automatically reduce the reverb level and when the singing stops, the reverb will increase naturally, brightening up the end of the phrases with all the force of its density.
I hope these examples allow you to grasp the potentiality of the sidechain. There are many other ways you could use this tool. Your imagination is the only limit, so go for it!