There are two main types of tank water heaters; gas and electric.
In a gas heater, a gas-operated flame at the bottom of the tank sends hot
air up a chimney that runs through the centre of the heater. This chimney
transfers heat to the water, and when you turn on the hot water tap, more
cold water flows into the heater, moving hot water up the hot water pipe.
Electric water tanks work the same way in terms of water displacement,
however their heating method is different. Electric heaters replace the
central vent with heating elements that extend out into the water tank.
Both styles of hot water heater also have a sacrificial anode that rusts
faster than the material the hot water tank is made of, preventing rust
from forming on the tank.