Stearic acid is a member of the group called fatty acids.
These are hydrocarbon chains (a chain made of repeated units of a carbon atom and two hydrogen atoms) with a carboxyl group at one end. A carboxyl group is the COOH in the chemical formula. It is what turns the hydrocarbon chain into an organic acid.
The carboxyl group in organic acids is reactive, and will easily lose its hydrogen to a compound that has a hydroxyl group, which is an oxygen atom joined to a hydrogen atom (OH). The H from the carboxyl group joins the OH of the hydroxyl group, and the two become HOH, more commonly seen written as H2O, or water. The water leaves as a separate molecule, and the two original molecules become joined at the point where the carboxyl and hydroxyl groups were.
One compound, glycerol, happens to have three hydroxyl groups. Glycerol can combine with fatty acids to form compounds called glycerides.
If there is one fatty acid, you get a mono-glyceride. If there are two fatty acids, you get a di-glyceride. When there are three fatty acids, you get a tri-glyceride.
One mono-glyceride is glycerol stearate. It is glycerol attached to stearic acid. Because it still has two free hydroxyl groups attached to the glycerol, that portion of the molecule is hydrophilic, attracted to water. The long hydrocarbon chain of the stearic acid is hydrophobic, attracted to oils and fats instead of water. This makes it a good emulsifying agent and surfactant. An emulsifier helps to mix oil and water, to make mixtures like mayonnaise and butter.
Di-glycerides are also emulsifying agents. You will see mono- and di-glycerides as ingredients in many foods that combine oil and water.
Tri-glycerides are fats. The fats in butter, in bacon, and in your body are all made of tri-glycerides.
Stearic acid is a saturated fatty acid. This means it has only single bonds between its carbon atoms. This means it can coil up and form into random shapes. Double bonds between carbon atoms restrict the bending of the molecule at the point of the bond, like a hinge that only lets a door swing back and forth, not up and down. Triple bonds are even more restrictive, locking the joint in place three-dimensionally, like the legs of a tripod.
Unlike most saturated fats, stearic acid does not seem to increase cholesterol levels in the blood, because liver enzymes convert it to an unsaturated fat during digestion.