Fossils provide geologists, archaeologists and biologists with the evidence necessary to understand the biodiversity of Earth, both now and throughout history. Through the process of fossilization, biological remains are preserved for incredibly long periods of time. These remains provide records from the specific time the organism was buried. There are many ways in which fossils are formed, though I will highlight just a few below.
Permineralization is the most common method by which fossils are formed. In this method, organic material is quickly entombed in sediment (this frequently happens to aquatic plants and animals on the ocean floor). This preserves the tissue and slows the decay process. However, decay still occurs, leaving pockets of space that are filled with leeched minerals. As more and more sediment covers the entombed organism, these minerals accumulate. Because the process is so slow, the minerals are able to fill crevices and spaces that are very small. This results in very detailed, accurate fossils.
Geological forces cause uplifting motions that can move fossils that have been covered in many meters of sediment. Without these forces, finding the fossils would prove nearly impossible for researchers. Thankfully, many fossils have been driven closer to the surface for us to discover!
In a process very similar to permineralization, known as carbonization (or imprinting), plant or animal material decomposes as sedimentation occurs, leaving impressions in the resulting rock layers with varying degrees of detail. The primary difference is the speed of decomposition. In carbonization, the material decomposes quickly without necessarily being encased in surrounding material. These fossils are frequently referred to as cast or mold. An endocast can also be formed in which the space inside of an organism is filled with material, essentially forming a mold of the internal cavity. These impressions can also be formed as soft material reacts with a surface during decomposition, resulting in imprints in the surface.
A unique form of fossilization, rapid freezing allows the material to be preserved almost perfectly. The process requires a flash freeze, making it very rare. However, because the specimens are nearly perfectly preserved, they often still have intact skin and hair. Some have even been found with food in their stomachs!
Similarly, organisms can become encased in other materials that perfectly preserve. One such example, popularized by Jurassic Park, is the process by which insects are trapped in amber running down a tree.
Dessication is the process by which remains are preserved through rapid and thorough drying. This happens most frequently in very arid climates. Mummified remains can contain well preserved soft tissue if the drying is rapid and complete.
To learn more about fossils, consult these references.