A hot water heater is a simple appliance; in the vast majority of cases, if it fails to function properly, it is due to one of three causes: the water supply to the heater, the thermostat that controls the heater or an internal problem with the heater's water storage tank.
Signs That Something is Wrong
The heater can fail to deliver sufficiently hot water, it can fail to deliver enough hot water or it can fail to do both. Troubleshooting the problem involves identifying which subsystem is malfunctioning, the water supply or the heating unit.
If There isn't Enough Hot Water
Check the underside of the heater tank and the water pipes leading to and from the heater. They should be free of signs of leakage, and there should be minimal signs of corrosion. If you see significant leakage, then repair or replacement is needed; if the leakage is from the tank, there may be internal corrosion, which will probably mean you have to replace the tank.
Another cause of insufficient tank capacity is that the tank slowly fills with dissolved solids. Hot water flowing through pipes will gradually leach out solids from those pipes, then those solids will settle in the tank. Your clue to whether this might have happened is that the hot water will smell metallic or muddy. This will happen most often if the water supply in your area is "hard," which means that the water entering your pipes already contains substantial dissolved minerals.
Flushing out Your Water Heater Tank
Flushing out your water heater will involve a drain valve on the bottom of the tank and the incoming water line on the top. Detach the incoming water line, and attach a garden hose; connect the other end of the hose to a cold water faucet. Open the drain valve, and turn on the cold water faucet to moderate pressure. Caution: there will be muddy residue coming out of the drain valve as well as residual hot water.
The Water Isn't Hot Enough
Usually, water not being hot enough is a very simple fix. First, check to see that the pilot light hasn't gone out. If it has, then follow the procedures for relighting it, often found on the door to the pilot light chamber itself, or in the owner's manual for the heater. Newer water heaters have an automatic pilot relighter that involves simply turning a knob; older heaters may require manual relighting with a match.
If the pilot light is burning, then the problem may be with the thermostat. If the thermostat is set at a medium or low setting, try moving it up a couple of notches; this may be all you need to do. If you move it to 3/4 or higher and your water still isn't hot enough, there may be a problem with the thermostat; at this point, you should consult a professional plumber.