A number of factors affect the ability to remove stains, the type of stain and the material of the rug, previous spotting attempts, and the age of the stain; Some stains can photo oxidize and become impossible to remove.
The sooner you can attend to the stain, the better chance you have of removing it completely. It's important to use an appropriate cleaning product and cleaning chemistry for the stain.
Improper spot cleaning and cleaning products can compound a stain and make in harder or impossible to remove