Let us take a look and see how it all works. Firsts things first stain RESISTANT carpet is exactly that resistant not stain proof. Stain resistant carpet makes it much easier to remove stains without having permanent damage done to the carpet.
There is a ton of fabrics that are used in the carpet making process, but one stands out above the rest making it one of the top materials used in carpet and that is nylon. Stain resistant carpet is basically a chemically treated fiber. Most companies use their own proprietary chemicals to make the carpet resistant. Normally the fibers are infused with the chemical solution before they are made and sometimes after the process of making it has began.
Make sure when you purchase your carpet the manufacturer provides you with all the necessary documents to help in the case of a stain. They may also have a number to call to get help if you come up with any questions about the cleaning process. Most of the time you are simply required to use water or a soapy water solution to clean it of any stains. Read through your documentation to make sure you take care of the carpet in spec with their manual.
This can help keep your carpet nice for a very long time. If you invest in a better carpet there is no reason for the carpet not last for 20 plus years. Also remember some things will ruin your carpet no matter what. Bleach is a big one that will permanently ruin your carpet no matter how quickly you clean it up. Yellow mustard is another that will ruin your carpet fast.