To remove a stain from a carpet, it will depend on the stain. For most, typical household stains:
Remove by blotting the stain with a clean cloth or paper towel to absorb any excess liquid.
Then, gently dab the stain with a mixture of mild soap (such as 1001 or Vanish) and water, working from the outside in.
Rinse with water and blot dry.
Repeat if necessary.