How do gas water heaters work?

Water heaters are a device that converts energy into heat, which turns into water. This amounts to placing a pan of water on the stove and warming it with the heat of the burner. The most common energy source used in water heaters is natural gas. However, some water heaters run on propane and electricity....