The headlights come on when the key is turned on and then flash off and on at different times. The light switch is in the off position when this happens. If the switch is turned to Park, the headlights still come on, and when fog lights switch is pulled, the fog lights won't turn on.
If your vehicle is experiencing intermittent problems with the headlights, there is probably some sort of electrical problem present somewhere. That particular year and model is known display symptoms such as the ones you describe, when the Central Timer Module has begun to fail. As this is an electrical problem, I would recommend having a professional technician, such as one from YourMechanic, diagnose your headlights to determine what needs to be repaired.
Our certified mechanics come to you ・Backed by 12-month, 12,000-mile guarantee・Fair and transparent pricing