The rate and the manner in which a human or animal body decomposes is strongly affected by a number of factors. In a roughly descending degree of importance, those factors include:
Insects and other animals are typically the next agent of decomposition, assuming the body is accessible to them. The most important insects that are typically involved in the process include the fleshflies (Sarcophagidae) and blowflies (Calliphoridae). The green-bottle fly you see in the summer is a blowfly.
Embalming affects the process, slowing it somewhat, but does not forestall it indefinitely. Embalmers typically pay the greatest attention to the parts of the body seen by mourners, such as the face and hands. The chemicals that are used in embalming will repel most insects, and slow the process of bacterial putrefaction, but will not preserve a corpse indefinitely. In sufficiently dry environments, an embalmed body may end up mummified.
The time for the reduction of an embalmed body to be reduced to a skeleton varies greatly. An unembalmed adult body buried six feet deep in ordinary soil without a coffin normally takes ten to twelve years to decompose fully to a skeleton, given a temperate climate. Immerse the body in water, and skeletonization occurs approximately four times faster; expose it to air, and it occurs eight times faster. The skeleton itself is not permanent; acids in soils can reduce it to unrecognisable components as well. Bodies exposed to cool, damp soil may develop a waxy substance called adipocere, caused by the action of soil chemicals on the body's proteins and fats. The formation of adipocere slows decomposition by inhibiting the bacteria that cause putrefaction.
Various sciences study the decomposition of bodies. These sciences fall under the general rubric of forensics, because the usual motive for study of the decomposition of human bodies is to determine the time and cause of death, for legal purposes: