Why do insects fly towards a light in the dark?

its obvious that insects fly towards lights, but why exactly? i know they are attracted to it, but why is this?
5 answers 5