With race cars, its becasue of the fuel mixture and how rich they're running. There is so much unburned fuel being pulling out of the combustion chamber while both valves are open, it ignites by the heat and gets sucked out while still burning. I can't explain the decelerating fire though, even though I've seen it too.
If that is true then I would think it happens when it decelerates because the valves are open a longer amount of time (not degrees) then when the engine is at high rpm. That is probably why I have seen it mostly when a car decelerates. I might be wrong though.
They are kicking in the after burners, LOL. I think its because air gets back up in the pipes when they get out of the motor, the mixture is still a bit rich from when they were in it hard and it post ignites. It makes a nice flame.
Stray, sort-of related fact:The reason top fuel engines crackle violently at idle (2k rpm~idle) is because so much of the nitro is going unburned in the chamber that it passes into the exhaust headers and into the air then it ignites. What you are hearing is that crackling, explosion-like burning of the nitro. Alky and gas don't have the ultra fast burn rate to create that sound.
The fire that I saw came from the Super Stock oval track cars. They are supposed to run on pump gas and on deceleration they were blasting fire out of their pipes cooking the track. I just think it would be cool to be at a stoplight and have some import come up and rev their engine. Then you return the rev along with the flames shooting out of your exhaust scaring the hell out of them.
I used to have an old 70 ford truck with a 352...We'd pull up to a stoplight and with a few burnt valves, it sounded pretty mean at idle. I remember when a hot camaro or ricer would pull up next to us, rev the motor, and dad would just floor it and turn the key off, then back on....talk about scared! Nice flames, too, especially at night!