Gearboxes are some of the most important parts of any motor. They are made to extend the life of the motor running as running a motor at high speeds in a low gear can make it overheat, therefore making it unusable.
Gearboxes can either be automatic or manual (manual is the one mostly found in cars). However the principle is the same. When something reaches a certain speed, there is a change in the cogs used to turn the engine. The cog connected to the gearstick (even in an automatic gearbox) changes from being hooked on one cog along the differential to being hooked onto another cog on the differential. These cogs help drive the drive shaft which is connected to the engine or motor, making whatever you want to work, work.
However, what's the difference between each gear is that the size of the gear. The lower the gear number, the larger the gear on the differential, and the smaller the corresponding gear is on the drive shaft. Due to torque mechanisms, it's far easier to drive a larger gear on the differential than on the driveshaft, and driving a big gear in the driveshaft at too slow a speed can lead to the motor stalling.
Reverse gears are obtained by turning the driveshaft (and by association – the engine) the other way. To do this, an extra small gear is placed between the gear on the driveshaft and the differential. As such, the gear on the differential needs to be quite big, and the gear on the driveshaft quite small, as – for safety reasons – if you slip it into reverse immediately when going forward, you will stall, rather than immediately fire the car backwards.