How does oil & dirt get washed away with soap?

We use soap each day in our lives in the form of detergents, shampoo, shower cr