Auriculotemporal nerve

The auriculotemporal nerve is a branch of the mandibular nerve (V3) that runs with the superficial temporal artery and vein, and provides sensory innervation to various regions on the side of the head.
Structure.
Origin.
The auriculotemporal nerve arises as two roots from the posterior division of the mandibular nerve. The mandibular nerve is a branch of the trigeminal nerve (CN5), and the mandibular nerve exits the skull through the foramen ovale. These roots encircle the middle meningeal artery (a branch of the mandibular part of the maxillary artery, which is in turn a terminal branch of the external carotid artery). The roots encompass the middle meningeal artery then converge to form a single nerve.
Course.
The auriculotemporal nerve passes between the neck of the mandible and the sphenomandibular ligament, gives off parotid branches and then turns superiorly, posterior to its head and moving anteriorly, gives off anterior branches to the auricle. It then crosses over the root of the zygomatic process of the temporal bone, deep to the superficial temporal artery.
Innervation.
The "somatosensory root (superior)" originates from branches of the mandibular nerve (cranial nerve V), which pass through the otic ganglion without synapsing. Then they form the somatosensory (superior) root of the auriculotemporal nerve. The two roots re-unite, and shortly after the branching of secretomotor fibers to the parotid gland (parotid branches), the auriculotemporal nerve comprises exclusively somatosensory fibers, which ascend to the superficial temporal region. There, it supplies the auricle, external acoustic meatus, outer side of the tympanic membrane and the skin in the temporal region (superficial temporal branches). It also carries a few articular branches that go on to supply the temporomandibular joint.
The "parasympathetic root (inferior)" carries postganglionic fibers to the parotid gland. These parasympathetic, preganglionic secretomotor fibers originate from the glossopharyngeal nerve (CN IX) as one of its branches, the tympanic nerve, which enters the tympanic cavity through the inferior tympanic canaliculus. The tympanic nerve and postganglionic sympathetic fibers, which come with the arteries-related head, make the tympanic plexus on the promontorium. This plexus gives off the lesser petrosal nerve. This nerve synapses in the otic ganglion and its postganglionic fibers form the inferior, parasympathetic root of the auriculotemporal nerve. The two roots re-unite and shortly after the "united" auriculotemporal branch gives off parotid branches, which serve as secretomotor fibers for the parotid gland.
Clinical significance.
This nerve, as it courses posteriorly to the condylar head, is frequently injured in temporomandibular joint (TMJ) surgery, causing an ipsilateral paresthesia of the auricle and skin surrounding the ear. It is the main nerve that supplies the TMJ, along with branches of the masseteric nerve and the deep temporal.
After a parotidectomy, the nerves from the Auriculotemporal Nerve that previously innervated the parotid gland can reattach to the sweat glands in the same region. The result is sweating along the cheek with the consumption of foods (Frey's syndrome). Treatment involves the application of an antiperspirant or glycopyrrolate to the cheek, Jacobsen's neurectomy along the middle ear promontory, and lifting of the skin flap with the placement of a tissue barrier (harvested or cadaveric) to interrupt the misguided innervation of the sweat glands.
Pain from parotitis, a condition that can be caused by mumps, will be carried by the auriculotemporal nerve and great auricular nerve to the brain.