Modern detergents contain more than surfactants. Cleaning products may also contain enzymes to degrade protein-based stains, bleaches to de-color stains and add power to cleaning agents, and blue dyes to counter yellowing. Like soaps, detergents have hydrophobic or water-hating molecular chains and hydrophilic or water-loving components. The hydrophobic hydrocarbons are repelled by water, but are attracted to oil and grease. The hydrophilic end of the same molecule means that one end of the molecule will be attracted to water, while the other side is binding to oil. Neither detergents nor soap accomplish anything except binding to the soil until some mechanical energy or agitation is added into the equation. Swishing the soapy water around allows the soap or detergent to pull the grime away from clothes or dishes and into the larger pool of rinse water. Rinsing washes the detergent and soil away. Warm or hot water melts fats and oils so that it is easier for the soap or detergent to dissolve the soil and pull it away into the rinse water. Detergents are similar to soap, but they are less likely to form films (soap scum) and are not as affected by the presence of minerals in water (hard water).
Modern detergents may be made from petrochemicals or from oleochemicals derived from plants and animals. Alkalis and oxidizing agents are also chemicals found in detergents. Here's a look at the functions these molecules serve:
These fats and oils are hydrocarbon chains which are attracted to the oily and greasy grime.
Sulfur trioxide, ethylene oxide, and sulfuric acid are among the molecules used to produce the hydrophilic component of surfactants. Oxidizers provide an energy source for chemical reactions. These highly reactive compounds also act as bleaches.
Sodium and potassium hydroxide are used in detergents even as they are used in soapmaking. They provide positively charged ions to promote chemical reactions.