Final answer:
The arrector pili muscle is the structure that lifts hair and causes goosebumps when contracted in response to cold or emotional stimuli.
Step-by-step explanation:
The structure attached to hair that can lift it and causes goosebumps is the arrector pili muscle. These tiny muscles are located in the skin's dermis layer and are connected to the hair follicle. When the body is too cool or in response to emotional stimuli, the sympathetic nervous system triggers the arrector pili muscles to contract. This contraction pulls on the hair follicles, causing the hair to stand erect, and simultaneously produces the raised bumps on the skin known as goosebumps. The presence of goosebumps in humans is a vestigial reflex; in other mammals, the raised hair helps with insulation or making the animal appear larger to predators.