What makes flames come out your exhaust?

Usually a product of valve overlap and exhaust. It's basically unburnt fuel coming through and igniting on the hot exhuast tip when it hits the air at the end of the exhaust pipe. In aspirated cars it's large valve overlap which helps scavenging and performance in the top end. Turbo cars, due to the large amounts of fuel at full noise. Normally happens after high RMP then throttle snapped shut.