Consider a simple circuit of a resistor of resistance $R$ connected to a battery of emf $\gamma$. When the battery is connected, it produces an electric field $\textbf E$. The wires of the circuit are obviously made of conducting material so that most of the electrons are in conduction band and are loosely bound. The electric field acts on these loosely bound electrons and causes an acceleration,
$$\textbf a=-\frac{e\textbf E}{m_{e}}$$ The negative sign implies that electrons move in direction opposite to the field, as the direction of the field is defined conventionally for unit positive charge and the electrons are negatively charged. The electrons that are now under motion, will have some kinetic energy and will in due time lose the energy as $\textbf{heat}$ when it collides with the kernals(metal ions) of the resistor. But the electrons after collision will get re-accelerated due to the field, so an overall current, say, $I$ flows through the circuit. Simultaneously, the electrons keep extracting kinetic energy from the field to continue their motion and keep giving off the energy in the form of heat in collisions. So, ultimately, $\textbf{all}$ of the energy extracted from the field will be lost as heat when the battery is switched off or the charge is drained out. 395
Let the energy that is lost as heat be $Q$.
Assuming that the connecting wires are ideal and offer no resistance, then the emf of the battery, $\gamma$, will be equal to the potential drop across the resistor, say, $V$. Thus $\gamma=V$. By Ohm's Law, we have
$$V=IR$$ so $\gamma=IR$
$\implies\gamma I=I^2R$
Now $\gamma$ is defined as the work done by the battery or the electric field in circulating $1C$ of charge across the circuit and $I$ is the rate of flow of charges(current). So the quantity $\gamma I$ denotes the rate of doing work by the battery or the field. If after time $t$, all the charge of the battery is drained out. Then work done by the battery is:
$$W=\gamma It=I^2Rt$$ The work done by the battery is the energy lost by the battery or the energy that the electrons extract from the field. We know that the energy lost as heat after the battery is drained of charges is $Q$. So, we have,
$$W=\gamma It=I^2Rt=Q$$
So in fact, all of the energy lost by the battery, ultimately appears in the form of heat. 780