Most smoke alarms operate on batteries, or have a backup battery. When these batteries fall below a certain power level (voltage), the smoke alarm warns us by chirping.
Now for the fun technical details!
Electricity is produced by a chemical reaction inside the battery. As with most chemical reactions, lower temperatures cause the battery's chemical reaction to occur more slowly. This causes the battery to have reduced power output. Since temperatures often drop during the night, the aging battery's power output also drops. When you have a battery that is near the end of its life, it may produce just enough power during the warmth of the day to satisfy the smoke alarm. However during the night when the temperature inside your home drops enough to slow the chemical reaction of the smoke alarm battery (and its power output), the low battery alarm triggers and warns us with those annoying 3 AM chirps.