Head lice are parasites that need human blood to live. They like to make their home close to the scalp, which is where they feed. Unless they get knocked off the hair, they will most likely live their entire lives (see the head lice life span) on their human host.
Lice use the claws at the end of their legs to crawl along strands of hair. Although their claws are designed to hang onto the hair, it is possible to inadvertently knock lice off the head with brushes, hands or hats. Once a louse is off its host, it will die within 24-48 hours, unless some other hair serendipitously comes along and the hitchhiking louse can catch a ride onto a new human host.