Help me to understand the simplest voltage multiplers
The capacitor stays charged because there is no current path for it to discharge (the diode only allows the current to pass one way). Here's what happens when you plug this in to 320Vpk (~230V RMS) AC power supply:

Initial condition, the power supply instantaneous voltage is zero, the capacitor is discharged:


1st 90 degrees of the power supply phase - the voltage rises to 320V. The diode is reverse biased, so the capacitor cannot charge, therefore the voltage at the output is also 320V.



2nd 90 degrees of the power supply phase - the voltage drops down to 0V. The capacitor voltage stays at 0V, so the output drops to 0V.



3rd 90 degrees of the power supply phase - the voltage goes negative and reaches -320V. Now the diode is forward biased and the capacitor can charge (current goes CCW), which means that the output stays at 0V. The capacitor charges to 320V



4th 90 degrees - the voltage does down to zero again, but the capacitor cannot discharge (for the capacitor to discharge, the current has to flow CW, however, the diode prevents it), so the voltage across it stays. The output voltage rises to 320V



5th 90 degrees (first 90 degrees of the second cycle), the voltage rises to 320V, but since the capacitor is charged to 320V too, the output rises to 640V.



6th 90 degrees - the voltage drops to zero, but the output only drops to 320V, since the cap is still charged.



7th 90 degrees - the voltage goes to -320V, the output to zero, the capacior is charged, so no current flows.



From here the 4th - 7th parts loop.

Essentially, the capacitor charges and provides a voltage offset to the power supply, look at this graph, the red line is input, the green line is output, vertical scale for both is 500V/div.