Insects often remain upside down when flies die. Because it is not easy for a dead insect to stand straight. When they die, their legs become unable to bear weight, and when falling, their backs, the heaviest part of their body, hit the ground.
Since the surface volume of the back parts is large, when the insect falls in this way, its legs remain facing the air. This is not the case for some insect species whose body height is greater than its width, they may fall sideways.
This is more common when they die from pesticides.
Nervous system consisting of the brain, spinal cord and all the nerves of the body; It controls everything that is done, including thinking, walking, feeling, breathing. Drugs disrupt the nervous system of insects, causing them to experience convulsions. In the meantime, they uncontrollably raise their legs and stand motionless on their backs. When their nervous system does not work, all the synchronized feature of their legs disappears.
So why do spiders curl up into balls when they die?
The flexor muscles in the legs of spiders pull the legs inward by contracting. But there are no extensor muscles to open the legs out. To do this, they use blood pressure, just as the penis swells as it fills with blood. Legs that cannot swell with blood after death therefore contract.
Spiders have a fluid called hemolymph in their circulatory system. The heart pumps this fluid throughout the body. Spiders do not have capillaries like humans do. The hemolymph flows into spaces called lacunae and the tissues become covered with this fluid; so they are fed. Afterwards, this fluid returns to the heart thanks to the pressure.
Sources: Live Science, IFL Science