To calculate the energy stored in an electric field, the derivation starts with (Wikipedia):
where is the charge density and is the voltage.
Where did the multiplier come from?
In a two charge system the total potential energy is is phi_1 * charge_2. The integration however includes phi_1*charge_2 + phi_2*charge_1. The halving factor is to compensate for this 'double count'. This is explained earlier on in the Wikipedia article.