To sell well, the shampoo must look good, must feel thick or creamy in the hands, and must produce a nice feeling lather. It must smell nice, and not be too expensive.
Other selling points might be the herbal extracts currently in fashion, or amino acids from exotic protein sources like silk or the milk of pigmy goats.
These detergents work best in water that has little calcium and magnesium, as these elements bind to the detergent and make an insoluble scum. So tetrasodium EDTA is used to sequester the calcium and magnesium from the detergent, while keeping them soluble, so they rinse away without scum.
Cocamide DEA (or MEA or TEA) is used as a foaming agent, to make the lather. The other surfactants will generate a certain amount of suds, but this foaming agent is added to get the amount just right. Besides its foam stabilizing effects, it is also a viscosity booster (it's thick).
Another foam stabilizing detergent is PEG-5 cocamide, which is a foam stabilizer, surfactant, and emulsifier.
The detergent cocamidopropyl betaine is added for several of its special properties. It is milder on the skin than the benzine sulfonates, so adding it to the mix reduces the amount of the harsher detergents needed. It is thicker than the other ingredients, so it can be added to make the mix have the right viscosity. It has anti-static properties, so the hair doesn't generate an electric charge and jump to the plastic combs and brushes used when drying the hair. It is a humectant, attracting moisture from the air, thus keeping hair from drying out. Lastly, it has antibiotic properties that can prevent spoiling of the shampoo.
The surfactant ammonium xylenesulfonate is a hydrotrope, a compound that makes it easier for water to dissolve other molecules. It is added as a thickener, and to help keep some of the odd ingredients added for marketing effect in solution, including perfumes. Glycerol stearate is another emulsifier used for this purpose.
Sodium chloride (table salt) is used to thicken the mixture if the main surfactants are sodium lauryl sulfates. If the surfactants are ammonium based, then ammonium chloride is used. Salt can make the shampoo harsh and sting the eyes, so more expensive thickeners are used to keep the salt levels low.
Modified cellulose based thickeners are often used, along with the surfactant based thickeners already mentioned.
Glycerine is added as a humectant (draws moisture from the air), as is propylene glycol, which is also a preservative.
There are many additives put in shampoos and conditioners that appear to be there mainly for marketing purposes. Honey, various herb extracts, and similar items might add to the fragrance, but are unlikely to have any effect in the concentrations used. Amino acids can act as conditioners, but the source of the amino acid is not important. Silk amino acids are no different from soy amino acids, except in the proportions of which particular amino acids are contained.
Another broad-spectrum biocide is isothiazolinone and the related methylisothiazolinone and methylchloroisothiazolinone.
Sodium benzoate is another preservative used in shampoos. It kills bacteria, fungi, and yeasts, and works well in acidic mixtures.
Another bactericide used is 2-bromo-2-nitropropane-1,3-diol.
Alkaline solutions raise these scales, so they stand up. This makes the hair rougher, makes it look dull, and makes the hair shafts stick together due to the rough texture.
Most shampoos are made slightly acidic, to keep the cuticle smooth and lying flat on the hair shaft. Ingredients like citric acid are added to acidify the shampoo.
As the shampoo mixes with the water in the shower or bath, or mixes with dirt on the hair, it can become less acidic as the acids mix with alkaline water or dirt. A compound that releases more acidifying ions when the acidity gets low, or absorbs acid when the acidity gets too high, is called a buffer.
A typical buffering agent used in shampoo is sodium citrate. Since the goal is to keep the shampoo slightly acid, the term "pH balanced" is actually a misnomer. We want the balance to be tipped slightly to the acidic side.
Silicone oils such as dimethicone and cyclomethicone are used to make the hair shiny and slippery.
Humectants (moisturizers) like panthenol help keep the cuticle moist, so that the scales do not stand up.
Long chain fatty alcohols like cetyl alcohol, oleyl alcohol and stearyl alcohol lubricate the hair. One end of the molecule binds to the hair, leaving the slippery fatty end on the outside to rub against other strands of hair, or a comb.
Quaternary ammonium compounds are cationic surfactants that bind well to anionic surfaces like the protien in hair. The ammonium end sticks to the hair, leaving the long fatty end of the molecule to act as a lubricant. They are slightly conductive, so the reduce the buildup of static electricity.
The "quats", as they are called, include compounds like stearalkonium chloride, disteardimonium chloride, quaternium-5 or quaternium-18, polyquaternium-10 and they are all similar in form and function to cetrimonium chloride.
These compounds are also widely used as fabric softeners, for all of the same reasons they make good hair conditioners. They are also used to thicken the shampoo.
The emollient isopropyl palmitate is used as a skin softener, moisturizer, and as an anti-static agent.