Deep inside the brain, below the outer cerebral cortex, sit an elliptically-shaped grouping of neural circuits, one group on each side, called the "Basal Ganglia." To function normally they require a steady supply of the chemical neurotransmitter dopamine, supplied from a region just below them in the upper brainstem. Much of what is known about this fascinating brain region comes from research on Parkinson's disease where this basal ganglia group of circuits malfunctions because of a lack of dopamine.
The classic basal ganglia control loop (avoiding too much neuroanatomical detail) functions as follows: You plan an action like hitting an oncoming tennis ball. A message is sent from the cerebral cortex motor planning region to the basal ganglia region. This basal ganglia region is highly connected to the other areas of the higher brain, as well as to the nearby lower "limbic" brain that assesses threats and basic drives (the "4 F's" fight or flight, feeding or fornication).