Charging means carrying charge from one plate to the other. Every bit carried leaves the plates charged, and the next bit is pushed back by the charge already there.
So the first bit is free, and the work needed grows as charge collects. The voltage at that moment is , which rises in proportion to the charge carried so far.
Put the charge carried on the horizontal axis and the voltage at that moment on the vertical one, and you get a straight line through the origin. The area under that line is the total work of carrying.
The area under the line is a triangle with base and height , so it is . That is the energy stored.
Substituting gives , and gives : the same quantity written three ways. Which one to use depends on what is being held fixed.
The factor is there because the final voltage was not present from the start. Had every bit been carried at , the work would have been , the area of the rectangle. The triangle is half of it.
The battery pushes a charge through an electromotive force , so it gives out of energy. What lands in the capacitor is only .
The other half becomes heat in the resistor. Early in the charging the difference in voltage is large, and the current is driven while that difference is dropped across the resistor.
That half does not depend on the size of the resistance. A smaller resistance means a larger current and a shorter time, but the total turned into heat is unchanged. It is a loss that comes with the circuit itself and cannot be designed away by choosing a resistor.
Close a charged capacitor through a resistor alone and the stored runs out. The resistor is the only place it can go, so all of it becomes heat there.
A capacitor consumes no energy. It holds charge and returns what it was given. What spends the energy is always the resistance outside it.
That is the difference from a battery. A battery makes energy by a chemical reaction; a capacitor does not. So no more comes out than went in, and the voltage falls by exactly as much as leaves.