When you suddenly changes the voltage on one side of a capacitor the other side instantly experiences the same voltage change.
It has to to that because at the instant of the change there is no extra charge in the capacitor and so if the far side didn't follow the same rise there would be a change in charge in zero time and that would be impossible.
So suppose you had a capacitor with side A at zero volts and side B at +5V. Then you make side A go to +5V, then side B must experience the same rise and so it goes to +10V. Then it starts to discharge until both sides are at 5V.
So with a capacitor you can generate a voltage doubling effect, two of these and you will multiply the voltage by 4. This is used in chips like the MAX232 to generate 12V from 5V, put some diodes in and you can generate -ve voltages as well, again like the MAX232.