system
Given the following post, respond as if you're commenting on Reddit:
human
Why do roaches turn over before dying?
gpt
Joel Achenbach used to have a great article in the Washington Post called "Why Things Are & Why Things Aren't" (available in book form!) in which he addressed this particular question.

Take it away, Mr. Achenbach...

>Bugs have a standard choreography of death.  Tremble.  Lurch.  Collapse.  Flip.  Wriggle.  Expire.   

>The lurching part is unsettling to watch, the flip is puzzling, and the wriggling as absolutely disgusting.  We realize some of our readers are squeamish about insects, so we will only mention one last time that as they die their legs are constantly wriggling, wriggling, wriggling.   

>We spoke to Dick Froeschner, an entomologist at the Smithsonian Institution who has watched many bugs die in various situations in the laboratory – another example of a job that's fun AND you get paid to do it – and he said the back flip is merely a function of gravity and inertia.  

>Think of a barstool.  The seat is perched high atop long legs.  If one or two of those legs were to suddenly collapse, the barstool wouldn't drop straight down but would topple over to one side.  The same thing happens to bugs, and that gets things rolling, so to speak, for them to turn upside down.  

>We should remember that insects have six legs, spiders eight (Rush Limbaugh ten).  In a diagram you'll see the legs evenly spaced and roughly in the same position.  In reality, they are continually moving in different directions, some splayed wide, some pulled in close.  When the insect starts to die, its legs will fold up, but not simultaneously.  One or two or three legs will collapse first.  The insect doesn't collapse straight down but topples over with some angular momentum.  

>It doesn't always roll onto its back, of course.  Sometimes it will be on its side, a-wrigglin' like there's no tomorrow.  The flailing will usually knock it the rest of the way over.  Once on its back, there's no return.  The legs are up in the air and they have nothing to push against.  

>"It's just the physical condition of things; there's nothing psychic or fancy.  It's just what happens and how gravity works on it," says Froeschner.  

>There are exceptions.  If a bug has something on which to clamp the claws on the end of its legs – there are itty-bitty claws down there – it can die standing up straight, with legs locked in place.
Makes you want to rush right out and get some Roach Motels, huh?