There are two general types of rivets used in aircraft structures. There are “blind” rivets, which are similar to “pop” rivets you might find at the local hardware store, except the ones used in aircraft are more carefully designed to ensure they provide a high-strength joint that will not degrade under stress and vibration. But the principle is the same: there is a tapered center rod that goes through a hollow cylinder, which allows the rivet to be inserted in a hole through two more more layers of metal. A special tool pulls that mandrel into the tube, which expands the cylinder on the far side of the hole, and then the cylinder breaks off on the near side of the hole leaving the mandrel fixed inside the cylinder:
These are installed with a special tool which can be hand-powered and looks much like a pop rivet tool from the hardware store, or can be a powered tool for use in factories and for larger rivet sizes which are too difficult to pull by hand. There are a great variety of types and sizes of these blind rivets.
The other major category is solid rivets. These are simply solid pieces of metal with a pre-formed “factory” head on one end and a solid metal cylinder on the other (known as the “shop” end. They are installed by inserting them in the hole and squeezing the shop end toward the head, compressing and widening the rivet as it shortens. The portion of the rivet inside the hole expands only slightly, gripping the inside of the hole, but the shop end expands typically by 50%, shortening by about 50% in the process, leaving a “shop head” which cannot go through the hole.
The squeezing is accomplished in one of two ways. If the rivet is near the edge of an assembly, like a door or window frame, there are squeezer tools which are like big angled pliers. One tip reaches around the assembly and has a flat surface to squeeze the shop end while the other tip has a surface that matches the factor head. The squeezer can be manual (lever) operated, although this is impractical for large rivets, or it can be powered. The tool usually comes with removable tips shaped and sized to fit the different types of rivet:
As you can see, this only works when there is a nearby opening for the squeezer jaw to reach the shop head. In other locations, a rivet gun is used. This is a powered (usually pneumatic) tool like a small jackhammer with a special tip to fit the factory head. On the other side of the rivet is a “bucking bar”, a piece of metal (usually hardened steel or sometimes tungsten) with a smooth hard surface to be held against the shop end of the rivet. When the hammer strikes the factory end the shock transmits through the rivet and the bucking bar bounces slightly, hammering back on the shop end, and after a number of cycles the shop end is hammered down just like the squeezer did. There is a bit of skill required to do that, but I’m not aware of anyone who wasn’t able to learn it relatively quickly. I found it slightly easier to do than learning to hammer a nail. A squeezer would be better to use in this picture, but it shows how a gun is used:
Solid rivets are generally lighter and less expensive, and given there can be many thousands of rivets in an aircraft, these are important attributes.