Examine your smoke detector each month in order to test it is still working as intended. Push the test button to hear the alarm sound. If it does not sound, check your battery-operated unit to be sure the battery is inserted properly or replace if needed. If it is an electrical connection, be sure the circuit breaker has not flipped and that the power is turned on to the detector.
Replace the batteries in your alarm yearly, under manufacturer's recommendations.
Always immediately replace the battery when the alarm issues the low-battery warning noise. Be aware the chirping has a time limit on it, and will usually quit after a few days, whether or not you replace the battery. Be sure when going on vacation to check the unit upon return to be sure it is still working properly.
Clean your smoke detectors each year, as dust can affect the unit. Do this on battery units by opening the alarm cover and vacuuming the interior with a soft-bristled duster brush.
For electrical connections, turn off power to the unit and only vacuum the outside venting of the alarm. Return power to the detector and test to make sure the alarm sounds.
Purchase new smoke alarms once every 10 years, which is the general life of a unit.