Carpet is made up of three components. Face yarn, primary backing, and secondary backing.
Face Yarn is "tufted" into the primary backing.
A tufting machine is basically like a large sewing machine. 800 to 2000 needles. The bar holding the needles is typically 12 feet wide. The needles penetrate the primary backing of the carpet which acts as a base cloth to hold the fibers. If the product being produced is a loop product the needles simply penetrate the backing and a "looper" (small hook) holds the size loop desired. If the product is a cut pile then the looper rocks back against a knife cutting the pile.
Primary backing usually polypropylene is what the face yarn is tufted into. It's the primary layer and therefore acts as the base to hold the fibers. After the tufting machine stitches the fibers into the primary backing, a layer of latex is applied to the back securing the fibers in place.
The secondary backing is the actual back of the carpet. Older carpets used to use jute. Today 95% of the backings are polypropylene. The main job of the secondary backing is to give dimensional stability to the carpet so it can be installed. In recent years manufacturers have developed a "soft back". This thin layer of fiber is applied to the secondary to help reduce the amount of scuffing on baseboards and walls during installation.