Ammonium laureth sulphate is a surface-active agent or surfactant. Surfactants are partly water-soluble and partly oil-soluble. This allows oil and water to mix.
A surfactant organises into a structure that can trap the oil-based dirt from the hair, allowing it to be rinsed away. The foam allows the hands to work shampoo through the hair more easily.
Sulphates became widely used in the 1930s and they started the development of the modern shampoo industry. It cleanses the hair, leaving it clean with beautiful shine.