Soap and detergents work by decreasing surface tension on water. When the surface tension of water is reduced it is able to better penetrate textiles. Once the water and soaps get into the fabrics they work by sticking onto the dirt and then washing it away. Once the soap or detergent has grabbed onto the dirt it’s done its job and won’t re-enter the garment as long as there is enough water present.