Evolution of nervous systems

The evolution of nervous systems dates back to the first development of nervous systems in animals (or metazoans). Neurons developed as specialized electrical signaling cells in multicellular animals, adapting the mechanism of action potentials present in motile single-celled and colonial eukaryotes. Many primitive systems, like those found in complex protozoa, use non-electrical signaling for motility and other aspects necessary for survival. Data suggests that these systems, which use a chemical gradient for messaging, evolved into the electrical-signaling cells known today. 
Simple nerve nets seen in animals like Cnidaria (jellyfish) evolved first, consisted of polymodal neurons which serve a dual purpose in motor and sensory functions. Cnidarians can be compared to Ctenophores (comb jellyfish), which although are both jellyfish, have very different nervous systems. Unlike Cnidarians, Ctenophores have neurons that use electrochemical signaling. This was perplexing because the phylum Ctenophora was considered to be more ancient than that of Porifera (sponges), which have no nervous system at all. 
This led to the rise of two theories which described how the early nervous system came about. One theory stated that the nervous system came about in an ancestor basal to all of these phylum, however was lost in Porifera. The other theory states that the nervous system arose independently twice (coevolution), one basal to Cnidarians and one basal to Ctenophores. 
Bilateral animals – ventral nerve cords in invertebrates and dorsal nerve cords supported by a notochord in chordates-- evolved with a central nervous system that was around a central region, a process known as cephalization. 
Neural precursors.
Action potentials, which are necessary for neural activity, evolved in single-celled eukaryotes. These use calcium rather than sodium action potentials, but the mechanism was probably adapted into neural electrical signaling in multicellular animals. In some colonial eukaryotes, such as "Obelia," electrical signals propagate not only through neural nets, but also through epithelial cells in the shared digestive system of the colony. Several non-metazoan phyla, including choanoflagellates, filasterea, and mesomycetozoea, have been found to have synaptic protein homologs, including secretory SNAREs, Shank, and Homer. In choanoflagellates and mesomycetozoea, these proteins are upregulated during colonial phases, suggesting the importance of these proto-synaptic proteins for cell to cell communication. The history of ideas on how neurons and the first nervous systems emerged in evolution has been discussed in a 2015 book by Michel Antcil.
Sponges.
Sponges have no cells connected to each other by synaptic junctions, that is, no neurons, and therefore no nervous system. They do, however, have homologs of many genes that play key roles in synaptic function. Recent studies have shown that sponge cells express a group of proteins that cluster together to form a structure resembling a postsynaptic density (the signal-receiving part of a synapse). However, the function of this structure is currently unclear. Although sponge cells do not show synaptic transmission, they do communicate with each other via calcium waves and other impulses, which mediate some simple actions such as whole-body contraction. Other ways sponge cells communicate with neighboring cells is through vesicular transport across highly dense regions of the cell membranes. These vesicles carry ions and other signaling molecules, but contain no true synaptic function.
Nerve nets.
Jellyfish, comb jellies, and related animals have diffuse nerve nets rather than a central nervous system. In most jellyfish the nerve net is spread more or less evenly across the body; in comb jellies it is concentrated near the mouth. The nerve nets consist of sensory neurons that pick up chemical, tactile, and visual signals, motor neurons that can activate contractions of the body wall, and intermediate neurons that detect patterns of activity in the sensory neurons and send signals to groups of motor neurons as a result. In some cases groups of intermediate neurons are clustered into discrete ganglia.
The development of the nervous system in radiata is relatively unstructured. Unlike bilaterians, radiata only have two primordial cell layers, endoderm and ectoderm. Neurons are generated from a special set of ectodermal precursor cells, which also serve as precursors for every other ectodermal cell type.
Nerve cords.
The vast majority of existing animals are bilaterians, meaning animals with left and right sides that are approximate mirror images of each other. All bilateria are thought to have descended from a common wormlike ancestor that appeared in the Ediacaran period, 550–600 million years ago. The fundamental bilaterian body form is a tube with a hollow gut cavity running from mouth to anus, and a nerve cord with an especially large ganglion at the front, called the "brain".
Even mammals, including humans, show the segmented bilaterian body plan at the level of the nervous system. The spinal cord contains a series of segmental ganglia, each giving rise to motor and sensory nerves that innervate a portion of the body surface and underlying musculature. On the limbs, the layout of the innervation pattern is complex, but on the trunk it gives rise to a series of narrow bands. The top three segments belong to the brain, giving rise to the forebrain, midbrain, and hindbrain.
Bilaterians can be divided, based on events that occur very early in embryonic development, into two groups (superphyla) called protostomes and deuterostomes. Deuterostomes include vertebrates as well as echinoderms and hemichordates (mainly acorn worms). Protostomes, the more diverse group, include arthropods, molluscs, and numerous types of worms. There is a basic difference between the two groups in the placement of the nervous system within the body: protostomes possess a nerve cord on the ventral (usually bottom) side of the body, whereas in deuterostomes the nerve cord is on the dorsal (usually top) side. In fact, numerous aspects of the body are inverted between the two groups, including the expression patterns of several genes that show dorsal-to-ventral gradients. Some anatomists now consider that the bodies of protostomes and deuterostomes are "flipped over" with respect to each other, a hypothesis that was first proposed by Geoffroy Saint-Hilaire for insects in comparison to vertebrates. Thus insects, for example, have nerve cords that run along the ventral midline of the body, while all vertebrates have spinal cords that run along the dorsal midline. But recent molecular data from different protostomes and deuterostomes reject this scenario.
Annelida.
Earthworms have dual nerve cords running along the length of the body and merging at the tail and the mouth. These nerve cords are connected by transverse nerves like the rungs of a ladder. These transverse nerves help coordinate the two sides of the animal. Two ganglia at the head end function similar to a simple brain. Photoreceptors on the animal's eyespots provide sensory information on light and dark.
Nematoda.
The nervous system of one very small worm, the roundworm "Caenorhabditis elegans", has been mapped out down to the synaptic level. Every neuron and its cellular lineage has been recorded and most, if not all, of the neural connections are known. In this species, the nervous system is sexually dimorphic; the nervous systems of the two sexes, males and hermaphrodites, have different numbers of neurons and groups of neurons that perform sex-specific functions. In "C. elegans", males have exactly 383 neurons, while hermaphrodites have exactly 302 neurons.
Arthropods.
Arthropods, such as insects and crustaceans, have a nervous system made up of a series of ganglia, connected by a ventral nerve cord made up of two parallel connectives running along the length of the belly. Typically, each body segment has one ganglion on each side, though some ganglia are fused to form the brain and other large ganglia. The head segment contains the brain, also known as the supraesophageal ganglion. In the insect nervous system, the brain is anatomically divided into the protocerebrum, deutocerebrum, and tritocerebrum. Immediately behind the brain is the subesophageal ganglion, which is composed of three pairs of fused ganglia. It controls the mouthparts, the salivary glands and certain muscles. Many arthropods have well-developed sensory organs, including compound eyes for vision and antennae for olfaction and pheromone sensation. The sensory information from these organs is processed by the brain.
In insects, many neurons have cell bodies that are positioned at the edge of the brain and are electrically passive—the cell bodies serve only to provide metabolic support and do not participate in signalling. A protoplasmic fiber runs from the cell body and branches profusely, with some parts transmitting signals and other parts receiving signals. Thus, most parts of the insect brain have passive cell bodies arranged around the periphery, while the neural signal processing takes place in a tangle of protoplasmic fibers called neuropil, in the interior.
Evolution of central nervous systems.
Evolution of the human brain.
There has been a gradual increase in brain volume as the ancestors of modern humans progressed along the human timeline of evolution (see Homininae), starting from about 600 cm3 in "Homo habilis" up to 1736 cm3 in "Homo neanderthalensis". Thus, in general there is a correlation between brain volume and intelligence. However, modern "Homo sapiens" have a smaller brain volume (brain size 1250 cm3) than neanderthals; women have a brain volume slightly smaller than men, and the Flores hominids ("Homo floresiensis"), nicknamed "hobbits", had a cranial capacity of about 380 cm3, about a third of the "Homo erectus" average and considered small for a chimpanzee. It is proposed that they evolved from "H. erectus" as a case of insular dwarfism. In spite of their threefold smaller brain there is evidence that "H. floresiensis" used fire and made stone tools as sophisticated as those of their proposed ancestor, "H. erectus". Iain Davidson summarizes the opposite evolutionary constraints on human brain size as "As large as you need and as small as you can". The human brain has evolved around the metabolic, environmental, and social needs that the species has dealt with throughout its existence. As hominid species evolved with increased brain size and processing power, the overall metabolic need increased. Compared to chimpanzees, humans consume more calories from animals than from plants. While not certain, studies have shown that this shift in diet is due to the increased need for the fatty acids more readily found in animal products. These fatty acids are essential for brain maintenance and development. Other factors to consider are the need for social interaction and how hominids have interacted with their environments over time.
Brain evolution can be studied using endocasts, a branch of neurology and paleontology called paleoneurology.