do water heaters shut of when they fail?
Generally no. It'll heat and reheat the water indefinitely if the supply is shut off but the tank is left full. 

If the power is left on and the tank is drained, the heating elements will probably self-destruct trying to heat non-existent water. 

Of course, newer and more sophisticated models may have damage prevention mechanisms in place.