Why do cockroaches flip over when they die?
It is a result from the insecticide you are using.  From this excerpt from the 10th Edition of the Mallis Handbook on Pest Control:


  Neurotoxic insecticides cause tremors and muscle spasms, flipping the cockroach on its back. A healthy cockroach can easily right itself, but without muscle coordination, the cockroach dies on its back. Cockroaches exposed to slow-acting insecticides that target respiration (energy production) also can die “face-down,” as they run out of energy without experiencing muscle spasms.


Here's also a website from UMass describing it in more detail:


  Most of these insecticides are organophosphate nerve poisons.  The nerve poison often inhibits cholinesterase, an enzyme that breaks down acetyl choline (ACh), a neurotransmitter.  With extra ACh in the nervous system, the cockroach has muscular spasms which often result in the cockroach flipping on its back.  Without muscular coordination the cockroach cannot right itself and eventually dies in its upside down-position.


And an entomology professor even answered this for Maxim:


  Most insecticides are poisons that target a bug’s nervous system. When you spray a roach, those neurotoxins cause tremors and muscle spasms, which flip
  it onto its back, and without muscle coordination, that’s the position it dies in