Gas units fail at the flame
On gas and propane heaters, the usual faults are a worn thermocouple or flame sensor that can't prove the pilot is lit, a clogged pilot orifice, a failing gas control valve, and poor draft in the flue. Draft problems matter most, because exhaust that spills back into the room carries carbon monoxide.
Electric units fail at elements and thermostats
Most residential electric tanks have two elements, each controlled by its own thermostat, plus a high-limit switch that cuts power if the water overheats. Elements burn out, especially when sediment buries the lower one, and thermostat contacts stick. Either fault shows up as lukewarm water, short supply or no heat.
Tankless units fail at scale, sensors and venting
Tankless heaters push water through a compact heat exchanger at high heat, so mineral scale hits them hard. Flow sensors, igniters and fans also wear, and the unit usually reports trouble with an error code that points the technician toward the right component.