I would give some make/model/year info if I wanted an accurate answer. It could be a bad circuit breaker.
Grounding wire is the usual culprit. chasing wires is always fun.
Every vehicle is wired differently. Since you're too lazy to list year, make, model, and engine, we're too lazy to list all the possible causes for every year, make, model ever made.
The filament in auto lamps are a hearty piece of metal. So it is going to burn out soon, just replace it now. If you can bump it and it goes on, the filament is on it's way out.
You just need a new head light switch also could be a fulty relay ground possible but not likely try the switch first
I'd check for a bad ground first.