There's a difference between spilling something like KoolAid on your carpet and spilling something like milk or mayonnaise. KoolAid might stain, but it won't get smelly. As milk and mayonnaise contain proteins and fats that will eventually decay and attract bacteria, they'll become smelly if they're not removed properly. Here are some steps to follow if you need to remove a potentially "stinky" stain from your carpet.
Step 1: Scrape and blot the substance.
The more of the substance you can remove at this point, the more effective the following treatments will be. (There will be fewer proteins and fats for them to work on.) If the substance has some thickness to it, like ranch dressing or mayonnaise would, try using a knife to scrape some of it up. If it's more watery, like milk, set a stack of paper towels on top of the spill. Press straight down, using as much pressure as you can, allowing the substance to absorb into the paper towels. Repeat this process with new stacks of paper towels until you're no longer getting any more moisture out of the carpet.
Step 2: Apply vinegar, dish soap, and water.
Vinegar is excellent at breaking down the proteins that will later generate a smell. It also has antibacterial properties. Dish soap helps break down fats. Create a mixture of half water and half white vinegar. Add a generous squirt of dish soap, and shake or stir the mixture just until it gets a little foamy. Pour enough of this mixture onto the area to soak it completely. Then, gently massage the carpet to ensure the dish soap makes its way into the fibers. Finally, use stacks of paper towels to blot up as much of the vinegar mixture as you can. The broken-down proteins and fats will come up with it.
Step 3: Sprinkle on some baking soda.
Baking soda will help absorb any lingering smells. It also draws residual moisture out of the carpet so it doesn't develop a musty odor as it dries. Sprinkle a generous amount on, ensuring that it covers the spill area completely. You really can't use too much. Let it sit for at least a day—two is even better. Then, vacuum it up.
If there is still a stain lingering after you follow these steps, then follow up with a carpet stain remover. The smelly bits should already be removed, so you only have to rely on the stain remover to remove the pigments and the last hints of staining. If you need professional help removing any stains from your carpet, contact a carpet cleaning company like R & R Steam Cleaning.