I guess you mean DNA test for paternity or forensics? To determine who was at a crime scene or whether you are related to someone?
Hair is basically made up of dead cells. However, even dead cells still do have DNA as the DNA does not die. I guess you know that cells are covered by lipid-protein (lipoprotein) layers. To get the DNA, you have to break down the lipoprotein wall to release the cell contents. Several methods exist for breaking the cell membrane: using chemicals such as detergents or mechanical force.
Once the cell contents are out, you filter the cell contents out…usually using a filter membrane. Because DNA and other nucleic acids are small, they will pass through the membrane but protein, lipid and carbohydrate molecules are large they will be trapped by the membrane. Additional chemicals are used to further concentrate and separate only the DNA.
There are regions of the DNA that are specific for each individual and acts as a genetic fingerprint…just like how unique your fingerprint is! Therefore, scientist extract these regions from the whole DNA and compare them with those from others. If we are related to someone, then these regions should be more similar. Developed countries such as the US, Germany, UK, etc store the genetic fingerprints from people so that they can use them for various purposes: identify a dead person (even burnt to ash), murderers, a baby’s parents, etc.
Do you want to be a forensics expert? It’s always what I wanted to do. Now I work a lot with DNA, RNA…and it is fun!!!!