The ejector is a small metal protrusion at the breech end of autoloading firearms that the base of the spent brass gets in contact with after it is extracted from the chamber.

As the slide, and hence also the spent case, is travelling at high speed from the recoil, blow back, or gas operation, this action ejects the case via the ejection port and flings it away from the operator.