It's a common sight: a dying cockroach lying on its back with its legs in the air.
The cockroach's body structure is such that its back is heavier (due to the hard wing covers and wings), while its abdomen and legs are lighter.
The legs splay out to the sides and, under normal conditions, are more than capable of supporting the body.
However, when a cockroach is affected by an insecticide (especially a neurotoxic insecticide like a pyrethroid), the nervous system is disrupted, leading to muscle spasms and paralysis; the legs lose their normal supportive function.
At this point, the top-heavy body flips over, and the cockroach ends up on its back.
Once flipped over on a smooth surface, it is very difficult for the cockroach to right itself—its legs are designed for rapid running, not for turning over.
In a natural setting, a dying cockroach would usually find a crack and hide inside, rather than dying out in the open.
If you find a struggling, upside-down cockroach in the middle of the room, it's likely that an insecticide is working.
But the reverse is not always true: finding only dead, upside-down cockroaches without any living ones does not necessarily mean the problem is solved.