Capacitors are a class of devices that have time dependent response. The mathematical description of the relation between the current through a capacitor and the voltage across it is I=C*(dv/dt)
With I an amperes, C in farads and dv/dt, the time rate of change of voltage, in volts per second.
Since pure DC has no rate of change, it produces no current through a capacitor. but any other voltage waveform from varying DC to sinusoidal AC or any other variation in voltage over time causes current to pass through capacitors.
There is also energy stored in any capacitor that does not have zero volta across it. The energy is
E=(1/2)*C*V^2 With E being the energy in joules or watt seconds, C in farads and V in volts.
The voltage cross a capacitor is also related to the total charge that has passed through it since its had zero volts across it. Q=C*V Where Q is charge in coulombs, C is farads and V is volts across the capacitor.
Capacitors are used for energy storage, filtering (frequency dependent response) including resonance with inductors, DC blocking (while passing AC riding on the DC bias), and timing circuits the measure the time it takes for a specific voltage change caused by a charging current. They can also be used to add up the total (integral) of a signal over a period of time as a voltage change across the capacitor, if the signal can be converted to a proportional current that charges the capacitor.