A cranial nerve is any nerve which is attached directly to the brain or brainstem. This is different from spinal nerves which are attached to segments of the spinal cord. Cranial nerves relay information more directly between the brain and body (mostly parts of the head and neck).

Each cranial nerve exists as a pair and is present on both sides of the central nervous system. All cranial nerves appear above the first vertebra in the neck (cervical vertebra).

In humans there are twelve cranial nerves pairs. They are numbered using Roman numerals I–XII based on their order from the front of the brain to the back, where the brainstem is.

Function
Cranial nerves provide motor and sensory stimulation mainly to places within the head and neck. This sensory stimulation includes sensations such as temperature, touch, taste, vision, smell,  balance and hearing.

Smell (I)
The olfactory nerve (CN 1) sends information about smells from the nose up to the brain. In the brain, this information is processed and becomes olfaction, or our sense of smell. The olfactory nerve is an is an afferent sensory nerve, meaning it takes in information from the outside world and sends it to the central nervous system.

Structure 
The olfactory nerve is the shortest cranial nerve. It is one of two cranial nerves that does not connect to the brain stem, the other being the optic nerve (CN 2).  

The olfactory nerve is not just one nerve, but a group of neurons working together to perform the same task. The olfactory neurons start branched out in the nasal cavity. From here, they reach up through the roof of the nasal cavity and connect to the olfactory bulb.

The olfactory nerve is unique because it is the only cranial nerve that can regenerate parts of itself if it is damaged.

Path of sensation  
Smell molecules called aromatics come up the nose and into the nasal cavity. Here, they are detected by olfactory neurons. These neurons are branched out along the lining of the nasal cavity. Olfactory neurons take in the signal from the smell molecules and make electric signals called action potentials. The action potentials move up the olfactory neurons through the roof of the nasal cavity, also known as the cribiform plate. After passing through the cribiform plate, the olfactory neurons send the action potentials to the olfactory bulb. From here, signals are sent through the olfactory tract and out to different parts of the brain. For example, some signals are sent to the frontal lobe, where smells are identified and labeled.

Damage to this path can cause anosmia, or loss of the ability to smell.

Vision (II)
The optic nerve (CN II) transmits visual information from the retina to the brain.

Eye movement (III, IV, VI)
The oculomotor nerve (CN III) controls most of the muscles related to the movement of the eye, including the eyelids and control of the pupil. The trochlear nerve (CN IV) and abducens nerve (CN VI) are each responsible for their own single eye muscles.

Facial sensation, jaw movement (V)
The trigeminal nerve (CN V) is called "trigeminal" because it is made of 3 parts. Together, all these parts are responsible for sensation in the face and larger facial movements such as biting and chewing.

Facial expression (VII)
The facial nerve (CN VII) controls the muscles of facial expression, and helps carry taste sensations from the back of the tongue and mouth.

Hearing and balance (VIII)
The vestibulocochlear nerve (CN VIII) transmits sound and equilibrium (balance) information from the inner ear to the brain.

Oral sensation, taste, and salivation (IX)
The glossopharyngeal nerve (CN IX) is a mixed nerve that carries a wide range of sensory and motor information.

Control of heart and digestion (X)
The vagus nerve (CN X) allows for parasympathetic control of the heart and digestive tract. It is the longest nerve of the autonomic nervous system in the human body.

Shoulder elevation and head-turning (XI)
The accessory nerve (CN XI) is a cranial nerve that controls the sternocleidomastoid and trapezius muscles.

Tongue movement (XII)
The hypoglossal nerve (CN XII) is involved in controlling tongue movements required for speech and swallowing.

Routes out of the brain 
After leaving the brain, the cranial nerves travel inside the skull. Some must leave this bony compartment to reach their destinations. Often the nerves pass through holes in the skull, called foramina. Other nerves pass through bony canals, longer pathways enclosed by bone. These foramina and canals may have more than one cranial nerve, and may also contain blood vessels.

Related pages 

 Neuron
 Central nervous system
 Brain stem

References 

Anatomy of the nervous system