The following description of an insect's nervous system is taken in its entirety from Meyer (2002).
The Central Nervous System
Like most other arthropods, insects have a relatively simple central nervous system with a dorsal brain linked to a ventral nerve cord that consists of paired segmental ganglia running along the ventral midline of the thorax and abdomen. Ganglia within each segment are linked to one another by a short medial nerve (commissure) and also joined by intersegmental connectives to ganglia in adjacent body segments. In general, the central nervous system is rather ladder-like in appearance: commissures are the rungs of the ladder and intersegmental connectives are the rails. In more "advanced" insect orders there is a tendency for individual ganglia to combine (both laterally and longitudinally) into larger ganglia that serve multiple body segments.
An insect's brain is a complex of six fused ganglia (three pairs) located dorsally within the head capsule. Each part of the brain controls (innervates) a limited spectrum of activities in the insect's body:
Protocerebrum: The first pair of ganglia are largely associated with vision; they innervate the compound eyes and ocelli.
Located ventrally in the head capsule (just below the brain and esophagus) is another complex of fused ganglia (jointly called the subesophageal ganglion). Embryologists believe this structure contains neural elements from the three primitive body segments that merged with the head to form mouthparts. In modern insects, the subesophageal ganglion innervates not only mandibles, maxillae, and labium, but also the hypopharynx, salivary glands, and neck muscles. A pair of circumesophageal connectives loop around the digestive system to link the brain and subesophageal complex together.
In the thorax, three pairs of thoracic ganglia (sometimes fused) control locomotion by innervating the legs and wings. Thoracic muscles and sensory receptors are also associated with these ganglia. Similarly, abdominal ganglia control movements of abdominal muscles. Spiracles in both the thorax and abdomen are controlled by a pair of lateral nerves that arise from each segmental ganglion (or by a median ventral nerve that branches to each side). A pair of terminal abdominal ganglia (usually fused to form a large caudal ganglion) innervate the anus, internal and external genitalia, and sensory receptors (such as cerci) located on the insect's back end.
The Stomodaeal Nervous System
An insect's internal organs are largely innervated by a stomodaeal (or stomatogastric) nervous system. A pair of frontal nerves arising near the base of the tritocerebrum link the brain with a frontal ganglion (unpaired) on the anterior wall of the esophagus. This ganglion innervates the pharynx and muscles associated with swallowing. A recurrent nerve along the anterio-dorsal surface of the foregut connects the frontal ganglion with a hypocerebral ganglion that innervates the heart, corpora cardiaca, and portions of the foregut. Gastric nerves arising from the hypocerebral ganglion run posteriorly to ingluvial ganglia (paired) in the abdomen that innervate the hind gut.
Deutocerebrum: The second pair of ganglia process sensory information collected by the antennae.
Tritocerebrum: The third pair of ganglia innervate the labrum and integrate sensory inputs from proto- and deutocerebrums. They also link the brain with the rest of the ventral nerve cord and the stomodaeal nervous system (see below) that controls the internal organs. The commissure for the tritocerebrum loops around the digestive system, suggesting that these ganglia were originally located behind the mouth and migrated forward (around the esophagus) during evolution.
*** SUMMARY of conclusions reached