Manufacturers of smoke alarms recommend replacing them every five years.
Smoke detectors use a radioactive element called americium.
A sensor detects the amount of radiation coming from the americium. If there is a sudden drop in the radiation detected, because smoke gets in the way of the radioactivity, then the alarm sounds. But americium has a half-life several thousand years long so running out of radioactivity isn't a problem. The reason you are advised to replace your smoke detectors every five years, is that the electronic detector inside might go wrong. Smoke detectors aren't like other pieces of electronic gadgetry in the home.