In the spring, the eastern half of North America turns into one big spittoon for spittlebugs. Wandering through a meadow, it's easy to spot the gobs of foam they produce, stuck to the stems of various plants. What makes spittlebugs produce so much spittle?
As the weather warms in spring, spittlebug eggs that were laid on plants in autumn begin to hatch. The spittlebug nymphs pierce the plant stem with their needle-like mouth parts and suck sap from the plant. However, the nymphs don't suck the nutrient-rich sap that carries sugars produced by photosynthesis. Instead, they pump out the sap that flows up from the roots, carrying water and other elements from the soil necessary for photosynthesis.
To get enough nutrients from this watery sap, spittlebugs have to pump up to 300 times their own weight in sap every 24 hours! They excrete the excess water in the form of that spittle you see on the plant stem.
The frothy mass may seem at first to be so much wasted spittle, but it also serves an important function by protecting and concealing the nymphs from predators. It works so well that the critters have no known predators. The spittle also provides a moist environment for the nymphs, preventing them from drying up. That's good news for spittlebugs but bad news for plants, which can wilt and become stunted as the nymphs pump out the sap flowing up from their roots.