How a battery works

A battery is essentially an entire electron manufacturing process.

A chemical reaction takes place at the anode that produces electrons. These flow through the external circuit to the cathode, where another chemical reaction uses up the electrons.

The electrodes are used up in this process and waste products are produced. This is why batteries run out after a while. In a rechargable battery the chemical reactions are run in reverse to repair the electrodes, but that can only be done so many times.

Fuel cells are essentially batteries where the raw materials are continually being added to the system, and waste products are constantly removed.