Basic automatic headlights work through sensors which detect how much light is there outside. These sensors are located on the dash of the vehicle mostly. The headlights turn on when the sensors detect a certain level of darkness (darkness means the level of light).
Most manufacturers wire the automatic headlights through the ignition switches of their cars. When the driver starts the vehicle and light levels are low, the headlights turn on automatically. When he switches off the key, the system turn off the lights.
However, there are limitations to automatic headlights. Sometimes they do not turn on during heavy rain or fog, as the light sensor still detects some light.
As technology improved, more and more innovations took place and auto headlights became safer and more powerful. Tungsten lamps were used but were quickly discarded because the filament broke very often and required a lot of cleaning.