First cold water is pumped through the roof panels, and is heated by the sun. The heated water then returns to the tank, and is stored for later use.
At night (or especially on cold days) the gas or electric booster makes sure the water is heated to a usable temperature.