There are two main types of smoke alarm for home use: ionisation and photoelectric alarms.
These contain a very small amount of radioactive material, which reacts to particles emitted in a fire and sets off the alarm. Ionisation alarms are best at detecting fast-flaming fires that don't emit much visible smoke. But many house fires tend to be smoky and smouldering long before they flare into flame, and ionisation alarms aren't as quick at detecting these. They can also be prone to nuisance alarms from cooking and steam, so shouldn't be located near your kitchen or bathroom.
These contain a photo cell and a light beam shining away from the cell. When smoke enters the test chamber, some of the light is scattered by the smoke particles and hits the cell, triggering the alarm. Photoelectric alarms are best at detecting smoky and smouldering fires, which is a common type of house fire. Dust or insects entering the unit can cause false alarms, so they have to be cleaned occasionally.