Crude oil is extracted from the earth through a process known as drilling. A well is drilled into an oil-bearing formation, and a pipe, called a casing, is placed inside the well to prevent the hole from collapsing.
A drilling rig, which is a large, specialized piece of equipment, is used to turn the drill bit and create the hole. Once the well reaches the oil-bearing formation, the crude oil is pumped to the surface using a system of pumps and pipelines.
The oil is then transported to a refinery, where it is processed into more useful and valuable products, such as gasoline, diesel, and other petroleum products.