There could be multiple reasons to cause a water heater to stop working. A few of the main reasons people encounter are:
Damaged in-line valve
Leakage in the pipes
Cathode rod problems
Overheating
Faulty Gaskets