AEGs (Airsoft Electric Guns) are electronically powered automatic rifles which come in a variety of shapes and sizes. Popular AEG manufacturers include Tokyo Marui, Classic Army, G&G and ICS, though (many) others do exist.
AEGs mechanics are driven by a motor, which turns the gears in the gearbox. There are typically four gears, the sector, spur, pinion, and bevel gears. The sector gear is not fully toothed (meaning that it is only partially covered with teeth). Its teeth lock into the teeth on the piston as the gear spins. This pulls the piston back, compressing the spring. When the sector gear runs out of teeth attached to the piston, it releases the piston, which causes the piston to shoot forward, propelled by the spring. This compresses the air in the cylinder, which escapes through the nozzle, propelling the bb. A tappet plate is pulled back by the gears and then pushed forward. This loads the next bb.
AEGs are powered by a battery. The typical voltages are 8.4v or 9.6v, though it can range from AA batteries for some low end guns to motorcycle batteries for the various Airsoft Miniguns in use. Generally, a higher voltage will give the gun a higher rate of fire. However, every gun has its limits, and putting in a battery too powerful for your gun will potentially strip the gears or otherwise damage the internals.
A new design growing in popularity is Lithium Polymer batteries, or LiPo batteries. These batteries are very powerful and can increase the Rate of fire greatly and are also very compact compared to NiMH and Nicd batteries with the same amount of storage space. However there are also disadvantages with LiPo batteries. with high voltage batteries, the current can jump between trigger contacts with is called arcing. When this occurs, it corrodes the metal and can burn holes in the metal making them useless. Higher voltage batteries increase wear and tear due to the fact that everything runs at higher speeds which causes parts to wear out faster. Airsoft LiPo batteries most commonly are either 7.4 or 11.1 volts with 11.1 being more popular.