Turn off the electricity to the alarm by shutting off the proper circuit breaker.
Remove the old alarm from its mounting bracket by turning the alarm gently until it comes loose.
Disconnect the old alarm from its wiring. In most instances this is a simple connector that needs to be unplugged.
If you are using the same brand and model of smoke detector, simply reconnect the wiring to the new alarm and snap back into place.
If you are using a different brand of smoke detector, remove the screws holding up the old mounting bracket.
Install the new mounting bracket by aligning the bracket over the holes from the old installation and replacing the screws. If the new mounting bracket does not line up with the placement of the old screws, you may need to drill new holes to mount the bracket.
Make sure the wiring comes through the center of the mounting bracket, and reconnect to the new alarm. Most alarms have an AC connector that makes it easy to connect a new alarm, however, if this is not the case, smoke detectors have four connections. The black wire is the power, the white wire is neutral, a bare or green wire is the ground wire, and the red wire is used to interconnect the alarm to other alarms. If you only have one alarm, then this red wire is not used.
Turn the alarm's power back on and ensure if it is working by pressing the device's test button.