The types of hydrocarbon extracted from the ground ranges from gas to crude oil and bitumen. Each deposit of hydrocarbon is different; some are all gas whereas others are various types of crude oil or mixtures of oil and gas.
Extraction methods also vary depending on the style of geology containing the hydrocarbon.
Geology with relatively large spaces between the grains of the rock, such as sandstone, may have hydrocarbons that can flow easily. This type of deposit represents the classical oil deposits, such as in Saudi Arabia. Generally, with such deposits, holes are drilled into the deposit and oil is pumped out.
Geology with very tight spaces, such as shale, do not have the conditions for hydrocarbons to flow easily. In this type of geology the rock needs to be fractured to allow the hydrocarbon fluids to flow more easily. To achieve this a relatively new technique called fracking is used to fracture the rock containing the deposit.
Both classical hydrocarbon extraction and fracking require the use of drill holes to access the deposit. If the deposit of hydrocarbon occurs below a water aquifer, or other form of ground water storage, the drill holes that access the hydrocarbon deposit will pass through the underground water store.
To prevent the hydrocarbon wells (drill holes) from contaminating the water lying above them, the wells need to be cased (lined). The casing of hydrocarbon wells needs to be done by people who are committed to doing so and who are extremely competent in doing such tasks.
Nothing is ever perfect and there will always be risks of well casing failing which would result in ground water contamination. It then becomes a question how large is the risk, what will be the effect of such a risk and who is prepared to take such risks.