Goosebumps are a physiological response that occurs when tiny muscles in the skins hair follicles, called arrector pili muscles, pull hair upright. The muscles contract in response to various stimuli, including cold, strong emotions, and physical exertion. The contraction of these muscles causes the hair to stand up, creating tiny elevations on the skin that resemble the skin of poultry after the feathers have been plucked. In animals with thick fur, this response helps keep them warm by expanding the layer of air that serves as insulation. However, this response is useless in humans because we do not have a hair coat.
Goosebumps can also be a sign of a long-lasting or serious medical condition, such as keratosis pilaris or temporal lobe epilepsy. While rare, some people may get goosebumps in the lead-up to or during a seizure.
In summary, goosebumps are caused by the contraction of tiny muscles in the skins hair follicles, which occurs in response to various stimuli. While goosebumps are a vestigial feature of the human body, they can also be a sign of a medical issue in some cases.