Swim Bladder
Fish, it turns out, are actually slightly more dense than the water in which they swim. They are almost neutrally buoyant, then, and do not have too much trouble staying suspended in the water. Pressure increases with depth, however, and fish use what is called a swim bladder to counteract this. As they swim, they extract the small amount of oxygen that is found in water, and use it to inflate their swim bladder, as necessary, depending on the depth of the water.
Death
When a fish dies, there is nothing to control the orientation of its body, and the swim bladder will slowly bring the fish to the surface. A typical fish, however, has more mass, in the form of bone and muscle, in the upper half of its body. Since this mass is heavy, it tends to want to sink more than the rest of the fish, and the fish will flip over in the water, which is why a dead fish floats on its belly.
Narcosis
Death is not the only reason, however, that a fish may float on its belly at the surface of the water. A fish in narcosis, or a fish that has been stunned, will also float on its belly near the surface. Fishery biologists, for example, pass electrical currents through the water to stun fish, and then collect the stunned fish for study. A stunned fish will quickly recover, however, and a fish that floats on its belly for more than a few seconds is almost certainly dead.
Delayed Response
When a fish dies, it may not immediately float to the surface, as there may be little or no oxygen in the fish's swim bladder when it dies. If this is the case, a fish will either stay suspended where it is in the water or sink to the bottom of the body of water it is in. Because a fish is a closed system, however, the gases given off during decomposition will eventually fill the inner cavity of the fish, and it will float to the surface. This is why it is generally a bad idea to eat a fish floating on the surface, because it may have been dead for some time already.