In breechloading firearms, an extractor is an action component that serves to remove spent casings of previously fired cartridges from the chamber, in order to vacate the chamber for loading a fresh round of ammunition.
In repeating firearms with moving bolts, the extractor is often one or a set of hook-like flanges on the bolt head that grabs onto the casing's rim, so when the bolt moves rearwards the casing is pulled out of the chamber. It is typically aided by a protruding ejector in the receiver or the bolt, which provides an opposite counter-push that couples with the extractor pull to expel the casing entirely out of the gun.
In modern dropping block, break-action (e.g. double-barrel shotguns) and revolver firearms, the extractor is a protrusible piece with flanges on the barrel/cylinder side, which pushes rearwards on the casing's rim and slides it out of the chambers. Some such extractors can push hard and far enough that they completely clear the cases out of the gun, thereby also performing the function of an ejector.