how does your body know when to grow hair, if i shave my hair on my arm or leg for example it will grow back but it will know when to stop how is this possible (the hair only grows to a certain length
Each individual hair only has a limited lifespan, so it grows continuously until it dies. Then it becomes loose and drops out (by combing or just on its own). Then a new hair starts growing from the same root. The maximum length of the hair therefore depends on how long it lives. Different types of hair are longer than others because they live longer (e.g. the hairs on the head live much longer than the hairs on arms or legs).
Actually Bernardo, hair is a collection of dead cells. Only the folicle contains living tissue. The length of your hair is due to millions of years of evolution and a genetic predisposition. It has nothing whatsoever to do with "how long it lives"
Cellular machinery (inside the cell) are programmed to 'kill' the cell after a certain amount of time. They determine the cell's lifespan. Problems in this machinery mean cells don't die and can lead to tumours.