CBSE Class 9 Answered
While water often mixes with other liquids to form solutions, oil and water does not. Water molecules are strongly attracted to each other, this is the same for oil, because they are more attracted to their own molecules they just don't mix together. They separate and the oil floats above the water because it has a lower density.
Detergent is attracted to both water and oil helping them all join together and form an emilsion, detergents have hydrophobic or water-hating molecular chains and hydrophilic or water-loving components. The hydrophobic hydrocarbons are repelled by water, but are attracted to oil and grease. one end of the molecule will be attracted to water, while the other side is binding to oil.