Oil and gas started out as tiny organisms
in ancient, shallow seas. Over millions of years, the remains
of these organisms piled up. As layer upon layer of sediment
accumulated and consolidated, the resulting pressure gradually
created a type of sedimentary rock known as oil shales. A lot
of oil shale can be found in the world today and it is possible
to distill oil from these rocks. However, it is expensive.
In some places, oil in the shale migrated out and gradually floated
upwards through water-saturated layers of sedimentary rock. Whenever
that oil reached an impervious surface that prevented further movement,
an oil (petroleum) deposit was formed. Most of the oil and gas we
extract come from such deposits.