According to energyeducation.ca, offshoreengineering.com, and personal.ems.psu.edu, the formation of a good oil and gas reservoir requires several specific conditions:
Source Rock: This is the rock that contains the kerogen from which the oil and gas forms. The source rock must be rich in organic material and must reach maturation through an increase in temperature and pressure.
Reservoir Rock: This is the porous, permeable rock layer or layers that hold the oil and gas. The reservoir rocks need to be both porous and permeable, meaning that there are small pockets of space within the rock where oil or gas can settle and small channels connecting these pockets to allow the oil or gas to flow out of this rock easily when it is drilled.
Cap Rock: This seals the top and sides so that the hydrocarbons are trapped in the reservoir, while water often seals the bottom. A cap rock or other mechanism must be present to prevent the oil and gas from escaping to the surface.
Migration Pathways: For a reservoir to exist, oil and gas from the source rock must migrate into the reservoir rock, which takes millions of years. This migration occurs because oil and gas are less dense than water, causing the oil and gas to rise towards the surface. Migration pathways - a set of well-connected fractures - must exist for this rising to occur.
Trap Formation: The rock formation must be formed or deformed in such a way to create a trap for the oil and gas. Anticlines are the most common formation shape for this to occur.
Pressure and Temperature: The two dominant variable conditions that affect every petroleum reservoir are pressure and temperature.
In summary, the formation of a good oil and gas reservoir requires a combination of geological, chemical, and physical processes over millions of years.