Soap is, technically, a salt. Thrilling explanation, right?
Soap is made by mixing a fat (fatty acids) with an alkali (base). According to any chemistry teacher I have had, mixing an acid with a base results in a salt. If you want to go beyond that, I would recommend that you pick up a good chemistry book. That way, you can learn all about ionic compounds, radicals, and the like.
Generally, when you mix an acid with a base, the results are pretty well instantaneous. The saponification reaction, however, is sluggish. If you mix one mole (6.02 * 10^23 molecules) of hydrochloric acid (stomach acid) with one mole of soda lye (Sodium Hydroxide - NaOH), you will very quickly get a whole bunch of heat. Once the solution cools down, you have a bunch of salt water.
HCl + NaOH --> NaCl + H2O (standard table salt + water)
You can think of it like this: The strong base grabs the hydrogen ion (H+) and strips it from the hydrochloric acid (HCl), then replaces it with a sodium ion (Na+). Confused?
When making soap, the strong base strips a hydrogen ion from the oil molecule and replaces it with a sodium ion. The hydrogen ion (H+) attaches itself to the remaining hydroxide ion (OH-), resulting in water.
Soap works by being a mongrel (it is an organic molecule with an sodium ion stuck on the end). The soap molecule is soluble in oil on one end, and in water on the other end.
Generally, oil and water don't mix. Soap allows this to happen by dissolving in both liquids simultaneously. An oil molecule will quickly attract the "oil" end of a bunch of soap molecules. The sodium end, however, will want to stay with the water. In this way, a particle of oil ends up being surrounded by a bunch of soap molecules. The soap molecules all have their heads stuck in the oil, and their tails stuck in the water. It therefore suspends the particle of oil.
Also, soap makes water wetter by breaking down the surface tension.
You see, water loves itself and tends to hang around in long chains. That's why water is a liquid. Most other molecules that size (the molecular weight of water is 18) are gasses. Water, being so gregarious, pulls itself together and remains a liquid at room temperatures.
The water at the surface tends to hold on even tighter. That's because a water molecule that is surrounded by water can reach out in any direction for a partner. At the surface, it has to reach down or to the side. It gets a tighter grip on the surface and allows you to float a needle if you do it carefully. Have you ever seen an insect walk across the water? Water striders do this quite handily because water has such a high surface tension.
If you add soap to the water, the sodium end of the soap molecules dissolve in the water. The oil ends, on the other hand, hate the water and try to escape. Those at the surface stick their tails right out of the water. This breaks the integrity of the surface tension.
Legend has it that soap was invented by the Romans.
A Roman woman was washing her clothes downstream of an animal sacrifice. She found that the animal fat that got into the water helped her clean the clothes. The fat had saponified by mixing with the clay.
It was later found that soap can be made by mixing any oil with an alkali (though the ancients didn't necessarily know anything about acids and bases). For a while, urine was used. Some people had the job of going throughout Rome and collecting urine So... you think your job is bad?
Soapmaking was a well kept secret for most of its history. Soap was, for the most part, used by the rich. The poor couldn't afford such extravagance.
One of the most common methods of making soap was to mix tallow or lard with potash. The mixture was boiled for a long time because potash is a relatively weak base, so the reaction is quite sluggish.
Potash is made by soaking wood ashes in water, then straining the solids.
It wasn't until recently (the last 200 years or so) that soap was made from lye. Before that, it was simply not available.