The simplest capacitor consists of two metal plates separated by an insulator or dielectric. We can pour + and – charges on to it by connecting the plates to opposite ends of a battery. We usually roll up the layers of insulator and conductor into a ‘swiss roll ‘ to save space. Just like milk bottles store milk, capacitors are components that are used to store electrical charge and are used with a resistor in timer circuits. When electrical power is supplied to a circuit that includes a capacitor – the capacitor charges up, in other words, a voltage develops across the plates. When power is turned off the capacitor discharges – its electrical charge leaks away slowly through a resistor.
This is useful in timers, also smoothing circuits where a current is changing and we want to smooth out the bumps. (see below)
Take a look at this link
When a switch opens the current tries to keep going by jumping across the gap creating a spark. (You can see this through the switch cover plate when you turn off a mains light switch).
Adding a resistor – capacitor network across the switch absorbs the energy of the spark. This protects the contacts from being worn away.