The detergent or surfactant in shampoo does create some of the suds and lather. Most shampoos have a surfactant like sodium lauryl sulfate or ammonium lauryl sulfate. These detergents are inexpensive and they do lather.
Shampoo, like many cleansers, is primarily made of a detergent. However, the detergent is not what really makes it lather. Shampoos have a foaming agent added to them. This is how we get that frothy foam we know and love. The most commonly used foaming agents are cocamide DEA, MEA or TEA.
Once you add water and a little friction to these two ingredients you get lather. Pour it into a bath under the running water and you get bubbles. Put it in your wet hair and rub it back and fourth with your hands and you have a foamy lather.