Canning-jar lids are made in two parts, the lid and the ring. The purpose of the ring is to hold the lid in place during the canning and sealing process. The inside rim of the lid is coated with a slightly sticky rubber coating.
The jars must be clean and smooth. As the lid is heated the rubber coating gently adheres to the jar and is held in place by the ring. This helps the jar to seal, but is not the primary cause of the seal.
When the food and liquid are placed into the jar, a small headspace of air is left in the jar. When the jar and food inside are heated by boiling or in the pressure canner, they expand and the air is driven out of the jar. The lid keeps more air from entering the jar.
When the processed food is removed from the canner and begins to cool, the food and air contract again. The air that was in the headspace has escaped the jar and a vacuum is created as the jar cools. This vacuum is strong enough to seal the jar and pull in the lid, causing the popping sound as the jars cool. When you hear the pop, the jar is vacuum sealed.