Various insects are attracted to the light for different reasons.
Some moths, for example, although nocturnal, are attracted to artificial light.
It's known that some insects have specialised receptors that let them detect ultraviolet light. They respond to colour wavelengths in flowers which are not visible to the human eye, and this could be what happens at night.
Other factors are involved - if the moon is bright, less insects are attracted to artificial light. Weather, too, can have an effect. Just before a storm is when you'll see the biggest number of insects around lights. Cooler, drier evenings won't attract nearly as many.