An article published in the British journal “Proceedings of the Royal Society London: Biological Sciences” (Nikos T. Papadopoulos, James R. Carey et al. 2002) is a very good example explaining this insect behavior before dying. This article investigates and discuss supine behavior in male Mediterranean fruit flies Ceratitis capitata Wiedemann. You can find out the PDF of this article through this link:
From an engineer's point of view most insects are mechanically unstable because they have a high center of gravity (like most SUVs!). To remain the right way up they would need to be in control of their posture and have fast 'righting' reflexes. When cold, old or dying they can lose control and flip over. Some researchers in our department (although not old cold etc) do this on field trips with SUVs and I suggested they have wheels fitted to the roofs.
Interesting. Not only insects, many aquatic animals do the same. Fishes and frogs are examples. In my mother tongue there is a usage "Chathu malarkkuka" which means die on your back.
In fact, this behavior may be, for example in the case of the Mediterranean fruit fly, regarded as a biological indice indicating (predicting) that the death of the insect individual is approaching. However, in other cases (circumstances) this behavior may be used as thanatosis (death feigning or playing dead), which is a behavioral response used by insects and other animals as defense mechanism. For example, in the parasitoid wasp Nasonia vitripennis Walker (Hymenoptera: Pteromalidae), a specimen fall onto its back, pulls in its limbs and antennae and become immobile for a few seconds before righting itself: this is a thanatosis behavior (see King and Leaich, 2006: through the link below (with useful references)). According to these authors, thanatosis was recorded as occurring when the wasp flipped onto its back or side and retracted its legs.