Shoot, sjmaxq, I thought I knew why moths fly into flames until I read the omnigenus theories of your URLs. After a careful reading of each I came to believe that all of these ideas were game attempts at understanding this odd moth behavior but each came short of making a convincing case.

Including the theory in the fourth URL that I found most reasonable, i.e. that moths fly into bright lights because of the interplay of the optical characteristics of moth eyes and the wave lengths of visible light which causes the moth to see darkness at the immediate edge of any bright light.
So, simply, the moths fly to the darkness as per their genetic instruction and since this darkness is ambient for a short distance around the light source they fly directly towards what they perceive as the darkest dark that they can see, and so circle the apparent darkness in an never-ending circle.

What a waste.

Too wasteful. So I came up with my own explanation to make the "Ambient darkness" theory fit my understanding of the processes of evolution and as such sit well in my brain.
Here it is ...

Back before bats gave birth to butterflies by driving a few moth species out from their nocturnal habits of a hundred million years and into the brave new world of daylight where birds and wasps found them tasty, but at least in the daytime there were no damn bats.

But today out of 165,000 species of the order Lepidoptera (more than all the species of mammals, birds, reptiles. and fishes combined) only 18,000 are butterflies and the rest are moths. See that stand of woods out your window? Most parts of those woodlands that are being eaten at this moment are being eaten by moths. Pretty good accomplishment for creatures so stupid that they fly into burning flames, huh?.

Still these hairy, fat, not-butterflies ( "hairy" because their hairs interfere with the honeing radar of bats.) do fly into bright lights and circle about, so why didn't they evolve a better response to the occasion of bright lights? Mmmmmm?

Like a bat out of hell it hit me...Ah Ha, Eureka, Raise the Flag! I got it!

Forest fires! Death fires; that can easily wipe out an entire species of night flying moths...unless, that is, the soon-to-be-incenerated moths fly straight towards the raging fire and then circle the flames and ride the rising hot thermals to safety while the fire passes harmlessly beneath.

A clear night holding a bottle of Jack Daniels while sitting around a popping hot campfire is my proof.