rewire them.
Loose connection somewhere. Bad switch maybe.
I have Samsung tablet screen flashing and cannot turn off
Headlights run off the battery not the ignition...
I've heard that if you have an automatic light switch sut-off switch and are having problem with your headlights flashing like a police car, it was caused by the cars computer.
replace the head light switch
When the headlights don't turn off when you turn off the car, the issue is probably a stuck relay. If you disconnect the battery for a few minutes they will go out. This is just a temporary fix until you can get it to a mechanic.
If it's just a round flashing light that has no indication as to it's meaning, it's probably the Daytime Running Light indicator. It's only on when the headlights are OFF. If it's flashing, it generally means that one of your DRL's has burned out.
If you mean they are on and flashing and your can't cut them off with the switch, the switch is bad.
check the door switch
Grounding issue. I'm guessing you have negatively switched headlights.
There are a couple of different times when you'd turn off your headlights. You'd turn off your headlights when the car is off for example.
check for loose connections or to see if the bulbs are loose also