Like many questions, the answer is "it depends." Many people think about a 20- or 30-year-old boiler the same way they think about a 10- or 15-year-old car: "It might need to be replaced soon, so I won't spend much money on it. I'll just wait and see what happens." When a car makes it several more years, people start to think, "If it lasted this long, there is no telling how long I can keep it, so I'm going to take good care of it." The same thing tends to happen with boilers if they make it to 40 or 50. The trick is knowing whether or not the boiler is likely to keep working for years and years.
There are several factors to consider when deciding whether to keep an existing boiler or install a new one, but the main factor is the condition of the metal the boiler is made of. Others include the condition of the doors, brickwork, burner and controls, and the suitability of the existing equipment to the application. If the boiler is the wrong size it might be wise to replace it regardless of its condition.
A visual inspection of the metal inside of the boiler is the most reliable way to assess the condition of a boiler, and should be done whenever practical. Steel boilers over 100 horsepower, which typically might be found in a multifamily building, are equipped with manholes that can be removed so the inside can be inspected visually. However, cast-iron boilers and many steel boilers do not have provisions for inspecting the inside. Shutting a boiler down and draining it to open it up is not an every-day event, therefore other methods must be used. If local codes or insurance regulations require annual internal inspections, checking the condition of the boiler once a year usually is a good measure.
As mentioned, the condition of the metal the boiler is made of is a primary consideration for boiler repair or replacement. How does metal begin to deteriorate in the first place?
Some boilers are used in applications such as hot water heating systems that, theoretically, are closed loops with no water lost from the system. Other boilers never heat the same water twice. For example, a desalination boiler on a submarine boils seawater to separate the water from the salt so the resulting steam can be condensed into drinking water. The salt stays behind in the boiler, which is frequently cleaned by blowing it down with pressurized water or steam, and mechanical cleaning. Most boilers fall somewhere between these two extremes, using a mix of new and recirculated water.