How do most fossils form?
Mineralization of buried parts
Once an organism dies its body can be buried in sediments that preserve it from the external environment.
Through the geological time the chemical elements composing the original organism (mostly carbon) are slowly substituted by other minerals (mostly silica) and the once biological specimen becomes a mineralogical specimen.
Usually the soft tissues decompose leaving the skeleton and hard parts only. As example dinosaurs fossils are mostly represented by their bones.
Under very specific circumstances a cast of soft tissues can be generated (as example if the sediments are very fine grained). A remarkable example is the Archaeopteryx, that is considered to be a link between dinosaurs and birds, found in the fine grained limestone deposits of Solnhofen in Germany. The feathers are still visible.
The most common fossils are seashells and this is due to two main reasons: the hard shell is easy to be preserved and the large number of specimen allowed for higher probability of preserving some as fossils.
Overall fossilization is a very long and rare process and a very small numbers of the organism that once lived on the planet are preserved as fossils.
When an organism or trace evidence is buried under water carried sediments the organism is preserved. The organism once buried under sediments can not be eaten or decomposed by bacteria. There are many examples of footprints that have been buried under sediments and preserved.
The water sediments often contained dissolved calcium carbonate from sea shells. Limestone is made from calcium carbonate. This forms a type of cement that preserves the remains of organisms and even impressions of the organisms.
Depending on the amount of calcium carbonate the formation of a fossil can be quite rapid. For example I have a fossilized spark plug found off of sunset bay in Oregon.
The buried organisms often undergo a secondary process of mineralization where the organic material is replaced by mineral. The fossilized wood of the Fossilized Forest in AZ are beautifully made of semi precious stones that show the grains and rings, of the original tree.