The answer to 'how does water heater work' is a water heater uses either electricity or natural gas to heat water that is stored in an insulated tank. The water is heated to a set temperature, typically between 120-150°F, and then kept hot until it is needed for use in the home. When hot water is needed, cold water enters the tank and the heated water is pushed out to the faucets or appliances that need it.
Water heaters have several key components that work together to provide hot water, including the tank, heating element or burner, thermostat, and various valves and pipes. The thermostat monitors the water temperature and turns the heating element or burner on and off to maintain the desired temperature. Over time, sediment can build up in the tank, reducing efficiency, so it's important to flush the tank regularly to keep it running well.