Moths are attracted to lights at night because they mistake them for the light of the moon, which they use as a means of navigation. These other lights confuse the moths and make them lose their sense of direction.
In trying to keep the artificial light at the same angle as the moon’s they circle it and come closer. Collectors use this behavior to trap moths with a special electric bulb, which gives off light rich in ultra-violet rays.
The insects are extremely responsive to these rays. But they can not see red or yellow. So by using a red light you can watch them feeding at night without disturbing them.