Fossils are the remains or traces of once living animals and plants. Hard parts like bones, teeth, seed pods, and shells are the most common types of body fossils. But we sometimes find fossils of soft tissues like leaves and can even have entire body fossils. Traces of prehistoric life like footprints, impressions, trackways, and coprolites (very old feces) are also fossils.
A miniscule percentage of past life is preserved as fossils. Most organisms died, decomposed, and were recycled into the earth. Even harder materials like bones and shells are worn down and turned into dust by natural erosion.
In order to avoid this ignominious fate, an animal or plant needed to be preserved and protected very quickly after death: a flash flood could quickly cover it in sediment, an avalanche could encase it in ice, a sandstorm could bury it alive, or it could fall into a pool of sap. The sooner it is covered up and the more anaerobic the conditions, the less it decomposes (or is eaten by scavengers) and the more of the body that is preserved.
The depths of the ocean are ideal for fossil making because they are covered in soft silt that can quickly cover an organism plus they are cold, anaerobic, and relatively calm. We find many more marine fossils than land fossils.
There are then several ways that the preserved remains can become fossils. The easiest is to have the actual tissues encased in ice, sap or tar so that they last. We have found some mammoth frozen popsicles and lots of nasty looking insects preserved in amber. Deserts are good at mummifying remains and we have found preserved intact specimens of marsupial wolves and other unlucky creatures.
The more common fossilization method involves creating a natural cast of the fossil that is then filled by minerals (permineralization or petrification.) Over geologic time, the sediments and silt that covered the remains are weighed down by layers on top, compressed, and become rock. Mineral rich water permeates the rock and causes the slow disintegration of the remains trapped inside the layers. However, as each bit is eroded away, minerals crystallize in its place so that the original tissues of the remains are replaced by mineral matter. Since each type of tissue erodes at a different rate, the minerals that replace each type crystallize in their place at different times – preserving the details and structures of the original composition. This is why you can see the bone cell structure in good dinosaur bone fossils.
Even after they have been preserved, most fossils will be destroyed or lost. Tectonic plate movements will likely heat, crush, or bury the fossils even deeper. The incredible luck that it takes for a fossil to form and then actually be found is astounding.
Now that you know how fossils formed, I hope that you will treasure them as they deserve!
PS If you want to read about the history of fossils, I highly recommend the book Remarkable Creatures by Tracy Chevalier. It is a historical account of Elizabeth Philpot and Mary Anning – two 19th century women that pushed the scientific community to realize that the fossils found on the Devon coast represented extinct creatures – a concept totally alien to a religious world view that could not conceive that God would have made animals only to destroy them.