
simulate this circuit – Schematic created using CircuitLab
A charged capacitor is always trying to discharge itself and will do so whenever the circuit it is part of permits current to flow between its two plates.
An analogy would be a stretched rubber band. It will spring back to its relaxed state whenever it is released from whatever is keeping it stretched.
More specifically, a capacitor discharges whenever the voltage in the circuit the capacitor is part of has a smaller magnitude than the voltage stored on the capacitor. So in the circuit above if the voltage across the capacitor is greater than the voltage of the voltage source, Vs, the capacitor will discharge through the resistor, R, until the voltage across the capacitor equals the voltage supplied by Vs. At that point current will stop flowing through R, as there is no voltage difference across it.
If Vs is greater than the capacitor voltage then current will flow through R charging the capacitor until the capacitor voltage is equal to Vs. Again, current will then stop flowing.
The answer by pjc50 links to the equations needed to calculate how long this takes.