Unlike today, washing the hair almost daily wasn't done and really wasn't needed. The first step towards keeping the hair clean is to keep it up and covered, something both men and women have been doing for ages. A cap, hat, or veil will prevent dust, dirt, and smoke from reaching the hair as well as absorb excess oil and sweat.
When cleaning, the only available soap would have been lye and was far to strong and damaging to use on the hair (though it was sometimes used to lighten the hair color). Instead, recipes for different ointments and treatments of the hair were available depending on the individuals needs. De Ornatu Mulierum (recipes for cosmetics) was written by Trotula di Ruggiero in the 12th century. Nostradamus put out recipes later, as did many others over the centuries. Some were for lightening or darkening the hair, others for faster growth, and some for cleaning of course. Fortunately for us, the De Ornatu Mulierum has been translated to English. A couple of examples: For soft and smooth and fine hair, wash it often with hot water in which there is powder of natron and vetch. For better smelling hair take dried roses, clove, nutmeg, watercress, and galangal. Mix them powdered with rose water. Sprinkle it through the hair and comb it with a comb dipped in the same water. Make furrows in the hair and sprinkle on the powder as well.
For things that are applied to the hair rather than just anointing the scalp it mentions to comb them through. Using a fine tooth comb will do well to remove the build up at the scalp and pull the natural oils through the hair, as will a boar bristle brush (our modern plastic brushes do neither). I must also note that clove or clove oil, a common ingredient, is a natural insect repellant (lice, ticks, and fleas).