Soap is a curious substance, designed to solve an intriguing problem. Most dirt that will not simply wipe off or be shaken out is in fact some form of fat or grease. In most households the most common cleaning agent is tap water. The problem is that grease and water fall into two different and largely incompatible chemical groups. Drop oil into water, and it will tend to float or form discrete droplets. Pour water into oil and you will see the same effect. Additionally, substances such as salt and sugar that dissolve in water will not dissolve in oil, whereas something like petrol will only float on water but is quite capable of dissolving oil.
The Chemistry of Oils
This difference in behaviour is due to the nature of the molecules involved. Water is largely polar, that is, water molecules tend to separate into fragments with opposite electrical charges, one positive and one negative. Chemicals such as table salt that happen to be made up of collections of charged fragments, or ions, find it easy to dissolve in water because the positive ions in the salt are attracted to the negative ions in the water, and vice versa. Similarly, the charged nature of water means that water is a good conductor of electricity.
Fats and oils, on the other hand, tend not to be polar. Their molecules have no particular electrical charge, and so are not attracted to polar substances such as salt. Instead, they prefer to bond with other non-polar substances. Fats and oils tend to be electrical insulators.
This, then, returns us to the washing-up. You have a greasy dish in a bowl of water, but the grease is showing no inclination to dissolve in the water because the water is polar and the grease is not. Attack the grease with a cloth and most of what you achieve is to move it around on the plate, because it is trying to flatten itself against the surface of the plate in a effort to get away from the water molecules.
The soap molecule is a halfway house. It consists of a long strand with an ionic water-loving, grease-repelling group on one end, and a non-polar grease-loving, water-repelling group on the other. If you drop soap into clean water, all the molecules gather on the surface with their water-loving (hydrophilic) ionic ends stuck in the water and their fat-loving (lipophilic) ends waving in the air. Slide a dirty dish in, however, and the lipophilic end of each molecule sticks to the grease as it slips past. As the dish sinks, it takes the soap molecules with it, attached by their heads to the grease but still waving their hydrophilic tails in the water like microscopic tadpoles.
All you have to do now is bash at the dirt with a sponge or cloth, and it can be persuaded to leave the plate, for as it lifts off the surface it becomes insulated from the water as new soap molecules rush in and try to bury their heads in it. The end result is a small blob of grease completely surrounded by a layer of soap molecules, all with their lipophilic heads pointing inwards and their hydrophilic tails pointing outwards. As far as the grease is concerned, all it can see are lipophilic molecules, and as far as the water is concerned, all it can see is a rather large hydrophilic lump.
Eventually, of course, all the soap molecules are used up, and you have to tip out the washing-up water and start again. Pass the tea-towel.