There are two thermostats on modern element. If they both fail or you only have one (old element) the tank will boil and the water/steam will go on the hot pipe, which should vent into the attic and into/over the cold tank. I say should, because I have seen what happen when the hot cylinder boiled, but a new cold tank was put in the year before and the plumber did not bother to move the pipe from the old cold tank to the new one.
There are actually two elements in a sink/bath element, thats why it still works on bath, which is a longer element to heat more water.