When oil is added to the water, the hydrophobic tails of the soap molecules are attracted to the oil molecules, while the hydrophilic heads remain in the water. This causes the oil droplets to be surrounded by a layer of soap molecules, which prevents them from coalescing into larger droplets. This is how soap helps to remove oil from surfaces.
In addition, soap molecules can also break down the bonds between oil molecules and other surfaces, such as skin or fabric. This is why soap is effective at removing grease and dirt from surfaces.