The structural, or pilosebaceous, unit of a hair follicle consists of the hair follicle itself with an attached sebaceous gland and arrector pili muscle.
The hair follicle begins at the surface of the epidermis. For follicles that produce terminal hairs, the hair follicle extends into the deep dermis, and sometimes even subcutis. Meanwhile, follicles producing vellus hairs extend only to the upper reticular dermis. There are three important segments of hair follicles found on the head: the infundibulum, the isthmus, and the lower follicle/inferior segment (which includes the bulb).
The infundibulum segment is the upper portion of the follicle. It begins at the surface of the epidermis and extends to the opening of the sebaceous duct. The isthmus is the area between the sebaceous duct opening and the bulge. The bulge is an area of the follicle marked by the insertion of the arrector pili muscle. Also, the bulge contains several epidermal stem cells that are part of the outer root sheath and stain with CK19, CK15, and CD200. Finally, the inferior segment of the hair follicle extends from the bulge to the base of the follicle. This segment includes the bulb, which contains the follicular matrix surrounding the sides and top of the dermal papilla. The dermal papilla contains capillaries. The papilla interacts with the matrix, which has the highest mitotic rate of any organ. The matrix is the part of the hair follicle where matrix keratinocytes proliferate to form the hair shaft of growing hair. Melanocytes are mixed amongst the matrix cells to provide the hair shaft with color.
The hair shaft consists of an inner core known as the medulla. This is surrounded by the cortex, which makes up the bulk of the hair. Moving outwards, there is a single layer of cells making up the shaft cuticle. The shaft cuticle is then encased in three layers that form the inner (internal) root sheath. The inner sheath is important in shaping the hair shaft as it grows upwards from the matrix. The inner sheath keratinizes from the outside-in, and will eventually disintegrate mid-follicle, around the level of the isthmus. Finally, the outer (external) root sheath encases the entirety of the hair shaft. This layer undergoes trichilemmal keratinization around the level of the isthmus.    
Sebaceous glands are holocrine glands closely associated with hair follicles, especially in certain areas of the skin such as the face. These glands open onto the hair follicles, except in areas such as the lips, where they empty directly onto the mucosa surface because lips do not contain hair follicles. When stimulated by hormones such as androgens, sebaceous glands secrete a lipid-rich sebum that protects the hair and provides the skin with a hydrophobic barrier that can serve as protection.   
Arrector pili muscles insert at the level of the bulge and also attach to the papillary layer of the dermis. In cold climates, sympathetic stimulation causes these muscles to contract. This raises the level of the skin slightly and causes the hair to stand erect, which is commonly referred to as “goose-bumps.” 
The hair follicle cycles through three different growth phases: anagen, catagen, and telogen.
Around 9 weeks gestation, the fetal epidermis gives rise to small buds of specialized cells that will form the hair follicle and its associated appendages. Mesenchymal cells that have accumulated within the dermis help drive this process by secreting substances such as epimorphin that signal the epithelial cells to proliferate and migrate in a downwards (craniocaudal) direction towards the dermis. Once this process is complete, the fetus is left with a hair follicle containing a matrix derived from ectoderm and an underlying dermal papilla-derived from mesoderm. Additionally, an arrector pili muscle and a sebaceous gland form around each follicle. In utero, maternal androgens will stimulate the activation of fetal sebaceous glands, so that the glands can secrete a lipid-rich sebum that combines with desquamated stratum corneum cells to form the vernix caseosa.
Once the hair follicle has developed in the fetus, lanugo hairs grow in utero. These hairs are thin and short. They eventually shed by about 36 to 40 weeks gestation and are replaced by vellus hairs that cover most areas of the body. Meanwhile, thicker, courser terminal hairs can be found on the head in certain areas such as the scalp, eyebrows, and eyelashes. Beard hairs will arise once puberty is reached, with androgen hormones transforming the vellus hairs in this area into terminal hairs.
Hair growth rate and hair density decrease with age. Hair loss, known as alopecia, is a common occurrence. It can be due to drugs, diet, hormone imbalances, altered mitotic activity, growth cycle abnormalities, among others. A thorough history, physical exam, hair pull test, daily hair counts, part width, clip tests to examine the hair shaft, hair growth windows, and hair pluck, and trichograms can all be used to diagnose hair disease. Scalp biopsies, hormone studies, and a potassium hydroxide examination for fungi may also need to be performed in certain cases. It is important to diagnose hair disease correctly, as the treatment for hair loss is dependent on the diagnosis.
Male pattern baldness, known as androgenetic alopecia, is a common condition in which hair loss occurs as men age. With increased dihydrotestosterone binding to the follicle of hair receptors, each successive anagen cycle shortens in length. In these individuals, follicles shrink and gradually produce shorter, thinner, more vellus-like hairs. Possible treatments may include slowing the conversion of testosterone to dihydrotestosterone in men with this condition.  
|||Hierarchical patterning modes orchestrate hair follicle morphogenesis., Glover JD,Wells KL,Matthäus F,Painter KJ,Ho W,Riddell J,Johansson JA,Ford MJ,Jahoda CAB,Klika V,Mort RL,Headon DJ,, PLoS biology, 2017 Jul [PubMed PMID: 28700594]|
|||Inhibitory autocrine factors produced by the mesenchyme-derived hair follicle dermal papilla may be a key to male pattern baldness., Hamada K,Randall VA,, The British journal of dermatology, 2006 Apr [PubMed PMID: 16536801]|
|||Paniagua Gonzalez LM,Tschen JA,Cohen PR, Ectopic Sebaceous Glands in the Hair Follicle Matrix: Case Reports and Literature Review of this Embryogenic Anomaly. Cureus. 2018 Nov 17; [PubMed PMID: 30680266]|
|||Poblet E,Ortega F,Jiménez F, The arrector pili muscle and the follicular unit of the scalp: a microscopic anatomy study. Dermatologic surgery : official publication for American Society for Dermatologic Surgery [et al.]. 2002 Sep; [PubMed PMID: 12269872]|
|||Wortsman X,Carreño L,Ferreira-Wortsman C,Poniachik R,Pizarro K,Morales C,Calderon P,Castro A, Ultrasound Characteristics of the Hair Follicles and Tracts, Sebaceous Glands, Montgomery Glands, Apocrine Glands, and Arrector Pili Muscles. Journal of ultrasound in medicine : official journal of the American Institute of Ultrasound in Medicine. 2018 Dec 20; [PubMed PMID: 30570163]|
|||Poblet E,Jiménez F,Ortega F, The contribution of the arrector pili muscle and sebaceous glands to the follicular unit structure. Journal of the American Academy of Dermatology. 2004 Aug; [PubMed PMID: 15280840]|
|||Chen R,Miao Y,Hu Z, Dynamic Nestin expression during hair follicle maturation and the normal hair cycle. Molecular medicine reports. 2018 Nov 26; [PubMed PMID: 30483790]|
|||Dobreva A,Paus R,Cogan NG, Analysing the dynamics of a model for alopecia areata as an autoimmune disorder of hair follicle cycling. Mathematical medicine and biology : a journal of the IMA. 2018 Sep 11; [PubMed PMID: 28992198]|
|||Grubbs H,Morrison M, Embryology, Hair 2018 Jan; [PubMed PMID: 30521215]|
|||Lolli F,Pallotti F,Rossi A,Fortuna MC,Caro G,Lenzi A,Sansone A,Lombardo F, Androgenetic alopecia: a review. Endocrine. 2017 Jul; [PubMed PMID: 28349362]|
|||Piraccini BM,Alessandrini A, Androgenetic alopecia. Giornale italiano di dermatologia e venereologia : organo ufficiale, Societa italiana di dermatologia e sifilografia. 2014 Feb; [PubMed PMID: 24566563]|