The Rivet and the Rivet Gun
Rivet guns are actually quite simple tools considering the complexity that riveting implies. The rivet gun itself is simply a pair of handles connected to wheels or ratchets; when the handles are squeezed together, the wheels turn or the ratchets crank to pull the rivet's pin into the rivet gun. The rivet itself is made up of a long nail-like pin (usually made of steel) with a thicker head made of a more pliable metal (such as aluminum).
When the rivet gun's handles are pulled together, this creates torque that pulls the pin of the rivet into the gun. This presses the head up against the gun, flattening it in the process. Once flattened, the rivet pin will break at a pre-made weak spot in the pin; this leaves the flattened head behind to hold the riveted materials together.
Using a Rivet Gun
Place the rivet's head through pre-drilled holes in the materials that you want to rivet together. Insert the pin into the rivet gun, making sure that the head butts up against the gun's body. Pull the levers together to draw the pin in, making sure that it snaps as the weak spot. If the pin does not snap off, release the levers and pull them again to finish the riveting job.