Where do goosebumps come from?

Why do they happen and where do they come from? 
Goosebumps are a physiological phenomenon that humans inherited from their animal ancestors [2]. They are caused by a contraction of miniature muscles attached to each hair [2]. Each time a muscle contracts, it creates a shallow depression on the skin surface, causing the surrounding area to protrude [2]. This causes the hair to stand up whenever the body feels cold [2]. In animals with a thick hair coat, this rising of hair expands the layer of air that serves as insulation, keeping the animal warm [2]. In people, goosebumps are useless because we do not have a hair coat [2].
There are various theories as to the origin of goosebumps, also known as piloerection, horripliation or pilomotor reflex [1, 3]. One theory is that goosebumps are a primitive reflex developed years ago that served to scare off enemies [2, 3]. Another theory is that they are a response to fear and cold [1]. Yet another theory is that they are stimulated by hormones released during intense feelings like fear, awe, or sexual desire [4]. Biologists believe that they are a reflex that we developed years ago and that furry animals also have this reflex to make them look bigger and scarier when they are in danger [3].  The reason goosebumps show up has to do with a tiny muscle that surrounds the root of every hair on your body. When the muscle tightens, a small bump appears on your skin [3].