Petroleum is formed due to decomposition of microorganisms which got buried under the sea over millions of years ago. Dead marine micro organisms got buried under sand and the effects of pressure, heat and bacteria got them converted into oily liquids. The decomposition took place in the absence of air or oxygen. Petroleum wells are generally found under the sea surface. Occasionally there are wells on landmasses also, but these are thought to be landmasses formed over the sea surface due to the motion of earth s crust.
Petroleum wells occur between layers on non-porous, impervious rocks.
The schematics of such a well is shown below. Oil deposits are found with water, dust particles, rocks, salt and sand. Wherever there is such a well, natural gas is also found accumulated in pockets of spaces within rocks. Petroleum can be extracted from oil wells by drilling. The first oil well was found in Pennysilvania in the USA in the year 1859.