Capacitors can be thought of in a number of ways depending on their size and their placement in a circuit. Whilst that does not change any of the fundamentals about a capacitor, the analogy used to describe it's behaviour can change (because analogies aren't perfect).

In addition a real life capacitor differs from a theoretical capacitor in many ways and these variances may dictate at least part of the behaviour (and certainly dictate your choice of an appropriate component) in a given situation (because real life capacitors aren't perfect either).

The fundamental nature of a capacitor can be summed up by i = C ( dv/dt ). Whilst that perfectly describes a perfect capacitor, it probably tells you as much about the use of capacitors as Ohms law does about the use of resistors.

What that equation does tell you is that the current flowing "through" a capacitor is proportional to the capacitance and the change in voltage. This is important in all the uses of capacitors, sometimes as stated here, and sometimes in the inverse (the change in voltage across a capacitor is inversely related to the capacitance and the current flowing into or out of the capacitor).

The first usage of a capacitor is to block DC. In amplifiers, we want the audio signal to pass into the amplifier, but we don't want the DC operating point altered by the incoming signal. In order to do this we need a device that allows AC to go through, but blocks DC. And that's a capacitor. The equation above tells us that for DC (dv/dt = 0 -- the unchanging part of the voltage) the current is zero, and hence is blocked. For AC (the audio signal) dv/dt is always changing, so that signal can pass.

The second major use is as a reservoir of power. One really good example is a camera flash. The capacitor stores a charge, and then it is released very rapidly to cause a xenon filled tube to emit a very brief pulse of light. In this case we want i to be very high, and the time to be very low. This implies that the rate at which the voltage changes is very fast.

A third application is in the creation of filters. A capacitor in conjunction with a resistor can provide various amounts of attenuation to a signal depending on frequency. An example of this is charging a capacitor through a resistor. A low frequency signal (dv/dt being small) will only require a small current, so the resistor will not drop much of the voltage. However a high frequency signal will have a higher dv/dt, and thus require a greater current to charge the capacitor. In this case the resistor will drop a greater amount of the voltage. Depending on how you arrange the capacitor and the resistor you can thus create a circuit which preferentially allows or blocks frequencies above or below a certain point. This may be used in an amplifier, for example, to prevent very high frequency signals (well above audible frequencies) from being amplified.

Deciding where to put capacitors requires far more knowledge than just "putting them where voltage sags", although there are very many situations where that is exactly what you do.