The simple function of a hot water heater is to heat the water. How does it do it? The thermostat senses the temperature of the water in the tank and turns the heating element on until the temperature of the water reaches the preset temperature. The thermostat then turns the power off to the heating element until the temperature of the water in the heater drops. The cycle then starts again.
The tank is covered with insulation to help the water stay hot longer, thus saving you electricity if you have an electric water heater. It is a common misconception that storage tank style water heaters run all the time, even if you are not using water. This is completely untrue. They do maintain the water at a fairly constant temperature at all times, but they are only using power intermittently as the temperature within the heater drops. The amount of time between cycles of reheating the water varies depending on several factors: the amount and quality of the water heaters insulation, the placement of the water heater, the amount of water being used, and the temperature setting of the thermostat.
The temperature and pressure relief valve (T&P Valve) is designed to release excess pressure from the heater in the event that the thermostat malfunctions and continues to heat the water. The anode sacrifices itself to prevent the other components of the tank from corroding.