As a handyman, I see missing smoke detectors all the time. It is usually the case that the detector was chirping and the homeowner removed it because it was bothersome, and probably keeping him awake at night. All that is left is the pigtail plug sticking out of the ceiling. It may be that they just didn’t get around to replacing the battery.
You will need a new smoke detector if you can’t find the old one.
If you are lucky, the new smoke detector will mate with the existing plug and will plug right in. If not, you will need to remove the old plug and wire in the new one that came with the new smoke detector. This isn’t difficult at all.
This is a direct wire-for-wire replacement. You can turn off the power at the breaker. You will notice that the plug has a black wire, a white wire, and either a yellow or red wire (which you may not even use). The house wiring in the ceiling has the same colors. Remove the wire nuts from the old plug and replace the new plug wires into the positions of the old plug wires. Tighten the wire nuts and then you can plug it into the new smoke detector. If you old plug didn’t connect the yellow or red wire, then don’t connect it either. This wire is an interconnect wire that makes all of the detectors go off simultaneously, rather than just the detector that has sensed smoke.
By the way, you might replace the cheap battery in the detector with a new one while you have it in your hand. The batteries that come with the new detectors are not a high quality battery, and you don’t know how long it has been sitting on the shelf.