During recharging the chemical reactions in a battery are reversed. The materials at the electrodes are rebuilt from ions in the electrolyte.
A battery consists of multiple cells. A simple cell has three main components: anode, cathode and electrolyte. When a circuit is connected across the electrodes (anode and cathode) chemical reactions take place where the electrodes are immersed in the electrolyte.
At the anode an oxidation reaction takes place.
At the cathode a reduction reaction takes place.
A product of the oxidation reaction are electrons. A necessary reactant of the reduction reaction are electrons. By connecting a circuit across the electrodes electrons can flow from the anode to the cathode and enable the reactions to take place.
The above process is the discharging phase of a battery. During charging electrons are forced to flow in the opposite direction and this reverses the chemical reactions, so that a reduction reaction takes place at the anode, and oxidation reaction takes place at the cathode.
During the discharging process new compounds are formed from the electrolytes (e.g. lead sulphate is made from lead at the anode and sulphate ions from the electrolyte in a lead-acid cell). Once all of the lead at the anode has been used up the discharging process cannot continue. During the recharging process the reaction is reversed and the lead anode is rebuilt from the lead sulphate.
The rebuilding process is similar to electrolysis, ions are deposited onto the electrode. In the case above lead sulphate is split into lead and sulphate ions, the lead is deposited onto the anode. This process continues until there is no more lead sulphate to rebuild from.