There are two main types of automatic weapons: recoil-operated and gas-operated.
Recoil-operated automatic weapons use the force of the recoil from the previous shot to cycle the action and load the next round. The most common type of recoil-operated weapon is the blowback action. In a blowback action, the slide (or bolt) is unlocked and allowed to move rearward when the firearm is fired. This movement extracts the spent casing and cocks the hammer or striker. As the slide (or bolt) moves forward, it feeds a fresh round into the chamber and relocks.
Gas-operated automatic weapons use a portion of the gas from the fired cartridge to cycle the action. The most common type of gas-operated weapon is the direct impingement system. In a direct impingement system, the gas is directed through a tube and into the bolt carrier. The bolt carrier is driven rearward by the gas pressure, and this movement extracts the spent casing, cocks the hammer or striker, and feeds a fresh round into the chamber.
Automatic weapons are typically used by military and law enforcement personnel, and they are subject to strict regulations in most countries.