I replace them whenever they fail, unless you get the very rare bulb that goes to an obvious dim, which is also a fail.
Speaking of head lamps, I took the family to the movies about six months ago and I had one fail right when I got out of the theater. This was about 30 minutes from where I live, and even in a different state. I immediately drove to a WM to get a replacement bulb, but the air box prevented me from changing it in the WM parking lot. Sure enough, a Barney Fife was working that night and pulled me over and gave me a warning fix-it ticket because of the headlamp bulb. He wanted to write me up with a monetary fine, but I offered to show him the new bulb and the freshly dated receipt in the trunk. He let me go, but I had to show back up at his police station within 48 hours with a signed statement from a cop from my state that it had been fixed. (Luckily, my niece is a state trooper and she happened to be visiting me the next day and I didn't have to go out of my way to find a cop) The signed statement still really didn't satisfy him as I show up the next morning with the signed fix-it ticket and he wanted to see for himself that it had been fixed. I told them that I had driven a different vehicle that day and the my ticketed vehicle was at home. By the look on his face, I'm really surprised he didn't make me drive home and bring back the fixed vehicle. He told me to hit the road.