Kingdom: Animalia
Phylum: Arthropoda
Class: Insecta
Order: Hemiptera
Suborder: Auchenorrhyncha
Infraorder: Cicadomorpha
Superfamily: Cercopoidea
Family: Aphrophoridae
Genus: Philaenus
Species: Philaenus spumarius and Philaenus leucophthalmus
Common name: Meadow Spittlebug, Froghoppers

There are about 2400 species of spittlebugs or froghoppers worldwide and about 15 in New Zealand 
These insects are best known for their nymph stage, which produces a cover of frothed-up plant sap resembling spit. The nymphs are therefore commonly known as spittlebugs or spit bugs, and their froth as cuckoo spit, frog spit or snake spit.
The frothy bubbles (sometimes call cuckoo spit ) is the intriguing thing about this insect. The nymph produces this protective covering in a most remarkable manner by forcing a combination of fluid from the anus and a gluey gland excretion out under pressure, as from a bellows, to make uniform bubbles. The tail pumps up and down to operate the bellows and keep the bubbles coming one every second, and the nymph is soon hidden under a mound of white foam, protected from the sun and from insect predators.  The insect can only breath by taking air from one of the larger bubbles or from the air at the surface of the foam.  The froth also insulates against heat and cold, thus providing thermal control and also moisture control. Without the froth, the bug would quickly dry up. 
The nymphs pierce plants and suck sap causing damage, and much of the excess filtered fluids go into the production of the froth, which has an acrid taste, deterring predators. In New Zealand, they are not serious pests.

Adult spittlebugs can fly or jump from plant to plant; some species can jump up to 70 cm vertically (100 times their length): a more impressive performance relative to body weight than fleas. This means they are exerting a force 400 times their body weight. This accelerates is at 4000 m/s2 over 2mm and is equivalent to an average-sized human leaping over a 210-metre building.

A photo of a spittlebug nymph in its final development stage when it is developing wings. The nymph is inside its protective bubble shield. How nymphs make these bubbles is illustrated in a photo at the bottom of this page.
1-spittle bug Helen Macky.jpg

The foam of Philaenus spumarius on seed head of Plantago lanceolataFoam of Philaenus spumarius on seed head of Plantago lanceolata .JPG

Spittle foam with early-stage nymph inside. The nymph is the yellow mass on the left. 
Philaenus spumarius Meadow Spittlebug.JPG
 
The nymph coming out of its foam protection.
Philaenus spumarius Meadow Spittlebug-001.JPG

Spittlebug nymph
Philaenus spumarius Meadow Spittlebug-002.JPG

Philaenus spumarius Meadow spittlebug-27.JPG 
The last stage of a nymph before becoming an adult.
Spittle bug. Philaenus spumarius.JPG

An adult Meadow Spittlebug on watercress
Philaenus spumarius Spittle-bug on watercress.JPG 

This photos below are of an adult of the NZ species Philaenus leucophthalmus
Adult spittle bug Philaenus leucophthalmus-001.jpg

Photos showing how a spittlebug nymph exudes excess moisture by extending its abdomen and then contacts it forcing out a bubble making gluey liquid and gas from its anus.Spittle bugs blowing bubbles.-1.jpg

Thanks to Wikipedia for text and information: https://creativecommons.org/licenses/by-sa/3.0/