The chemistry of the gel
If you are interested in the chemistry of a gel, Wikipedia tells us that in
"high-ester pectins at soluble solids content above 60% and a pH-value between 2.8 and 3.6, hydrogen-bonds and hydrophobic interactions bind the individual pectin chains together. These bonds form as water is bound by sugar and forces pectin strands to stick together. These form a 3-dimensional molecular net that creates the macromolecular gel. The gelling-mechanism is called a low-water-activity gel or sugar-acid-pectin gel. In low-ester pectins, ionic bridges are formed between calcium and carboxylic acid of the galacturonic acid. This is idealized in the so-called “egg box-model”. Low-ester pectins need calcium to form a gel, but can do so at lower soluble solids and higher pH-values than high-ester pectins."
Effectively, pectin's structure binds with water in an acid environment. Sugar increases pectin's ability to gel, and affects the texture and consistency of jellies and jams as they cool and set. Note: sugar is not key to the preservation of the jam - the sterile environmental and acidity are more important.