In the United States, firearms manufactured after 1968 must contain a unique serial number somewhere on the metal frame. This number is contained on Firearms Transaction Record, or form 4473, at the time of purchase from a federal firearms license holder like a retail gun store. This form contains the pertinent information of the buyer of that firearm and can be used to trace that firearm back to the original owner. This is especially helpful when the weapon has been stolen.
There are a couple of different ways that manufacturers create this unique serial number but for the purposes of this posting I’ll keep it simple. The vast majority of modern firearms have their serial numbers stamped into the metal. Basically a very powerful press fitted with the alpha-numeric blocks strikes the metal in the same manner you might use an office ink stamp on paper. The process compresses the metal with tremendous force and alters the metallurgy even under the numbers themselves. This is a key aspect of why serial number restoration works.
Criminals using stolen weapons sometimes make efforts to deface or destroy that serial number (which is a crime) so police can not trace it back to the original owner. The gun may be from a relative, friend, or may link them to another crime such as burglary. There are a variety of ways a criminal might deface a serial number including grinding, drilling, hammering, and punching. These efforts may make the numbers unidentifiable to the naked eye and criminals usually stop when they can not make out the numbers (just as they may stop cleaning when they stop seeing blood).
There are a variety of reagents and etching techniques dependent on the type of metal being worked on but for the sake of this article I’ll describe the use of Fry’s reagent (a chemical etchant). Step one in the process (after initial photography) is to polish down the metal (in the damaged area) to a smooth surface. During this process, or at anytime throughout the etching process, some numbers or letters may become visible. In fact, the analyst may never recover all of the numbers at the same time so documenting them along the way is crucial.
A cotton swab is used to apply the etchant, rubbing in the same direction. After a few minutes the area is cleaned with water, dried, and re-polished. The process is repeated, each time checking for any numbers that may have developed. Eventually, the analyst may develop the entire number (or enough of it) to allow for a records search.
In your novel you could consider using a gun that can be traced back to the killer, or his family, or a major crime (like a gun store robbery). The criminal or co-conspirator might then damage the serial number on the weapon before discarding it. When your detective finds the weapon they can then take the above actions to restore it and discover the serial number. This is just the beginning of the search. The weapon may be decades old and have changed owners numerous times. The detective will have to hunt down each of those owners (if possible) and figure out who may have been responsible for the crime. Each owner may spin the investigation off into a new direction and create additional obstacles for your protagonist to overcome.