Headlights are standard equipment on all motor vehicles. The laws on headlight use are determined by the states, and though there are some small differences, the relevant laws are similar throughout the U.S.
Headlights serve two primary functions. One is to let you see where you are driving. The other is to make sure the other driver sees you and does not run into your car or pull into the lane just in front of you. Cars are often very hard to see without headlights in inclement weather like rain or fog and in dusty or smoky environments like construction areas or around forest fires.
Most states require motor vehicles (except motorcycles) to have two functioning headlights. Drivers are required to have the headlights on during the hours of darkness. States define that in slightly different ways, but the basic rule is that you should turn your headlights on from sunset to sunrise. You also need to use your headlights anytime visibility is low. Some states, like California, Ohio, and Pennsylvania, have passed laws saying that if the weather is bad enough to turn on your windshield wipers, you have to turn on your headlights too. Other states require drivers to use headlights in specified areas, like construction zones. Drivers can use their headlights on high beam, but they need to dim the headlights when they are within a certain distance of other cars, usually 500 feet from an oncoming car or 200 feet from a car in front.
Fog lights are ancillary lights, which means they can be used along with headlights in bad weather, but should not be used instead of headlights, particularly not in the dark. Some drivers use fog lights during dusk and dawn, instead of headlights, but this is not a legal use in any jurisdiction. Enforcement of this is often lax.
The main consideration is always driving safety. If there is any doubt about visibility, you should turn on your headlights. Cars in some colours, like white, beige, grey or light brown, might be harder to see in fog, heavy rain, dust or smoke, so using headlights can be part of defensive driving.
The best way to avoid accidents caused by poor visibility is to keep headlights in good working order. Your lights should be bright enough for you to see clearly, and you should have both low beam and bright headlights so you can see at night outside urban areas. You also need to keep the beams of your headlights at the proper level so that they do not shine in the eyes of oncoming drivers and blind them or shine into the mirrors of cars in front of you.