Learn more about Oil well
The earliest oil wells were drilled percussively by hammering a cable tool into the earth. Soon after, cable tools were replaced with rotary drilling, which could drill boreholes to much greater depths and in less time. Modern wells drilled using rotary drills can achieve lengths of over 12 000 meters (38,000 feet).
Until the 1970s, most oil wells were vertical (although different lithology and mechanical imperfections cause most wells to deviate at least slightly from true vertical). However, modern directional drilling technologies allow for strongly deviated wells which can, given sufficient depth and with the proper tools, actually become horizontal. This is of great value as the reservoir rocks which contain hydrocarbons are usually horizontal, or sub-horizontal; a horizontal wellbore placed in a production zone has more surface area in the production zone than a vertical well, resulting in a higher production rate. The use of deviated and horizontal drilling has also made it possible to reach reservoirs several kilometers or miles away from the drilling location (extended reach drilling), allowing for the production of hydrocarbons located below locations that are either difficult to place a drilling rig on, is environmentally sensitive, or is populated.
 Life of a Well
The creation and life of a well can be divided up into five segments:
The well is created by drilling a hole 5 to 30 inches (13–76 cm) wide into the earth with an oil rig which rotates a drill bit. After the hole is drilled, a steel pipe (casing) slightly smaller than the hole size is placed the hole, and is secured in the hole with cement. The casing provides structural integrity to the newly drilled wellbore in addition to isolating potentially dangerous high pressure zones from each other and from the surface.
With these zones safely isolated and the formation protected by the casing, the well can be drilled deeper (into potentially more-unstable and violent formations) with a smaller bit, and also cased with a smaller size casing. Modern wells often have 2-5 sets of subsequently smaller hole sizes drilled inside one another, each cemented with casing.
To drill the well,
- The drill bit, aided by rotary torque and the compressive weight of drill collars above it, breaks up the earth.
- Drilling fluid (aka "mud") is pumped down the inside of the drill pipe and exits at the drill bit and aids to break up the rock, keeping pressure on top of the bit, as well as clean, cool and lubricate the bit.
- The generated rock "cuttings" are swept up by the drilling fluid as it circulates back to surface outside the drill pipe. Then go over "shakers" which shakes out the cuttings over screens allowing the good fluid to return back into the pits. Watching for abnormalities in the returning cuttings and volume of returning fluid are imperative to catch "kicks" (when the pressure below the bit is more so than above causing gas and mud to come back up uncontrollably) early.
- The pipe or drill string to which the bit is attached is gradually lengthened as the well gets deeper by screwing in several 30-foot (10 m) joints of pipe at surface. Usually joints are combined into 3 joints equaling 1 stand. Some smaller rigs only use 2 joints and newer rigs can handle stands of 4 joints.
This process is all facilitated by a drilling rig which contains all necessary equipment to circulate the drilling fluid, hoist and turn the pipe, control downhole pressures, remove cuttings from the drilling fluid, and generate onsite power for these operations.
In a cased-hole completion, small holes called perforations are made in the portion of the casing which passed through the production zone, to provide a path for the oil to flow from the surrounding rock into the production tubing. In open hole completion, often 'sand screens' or a 'gravel pack' is installed in the last drilled, uncased reservoir section. These maintain structural integrity of the wellbore in the absence of casing, while still allowing flow from the reservoir into the wellbore. Screens also control the migration of formation sands into production tubulars and surface equipment, which can cause washouts and other problems, particularly from unconsolidated sand formations in offshore fields.
After a flow path is made, acids and fracturing fluids are pumped into the well to fracture, clean, or otherwise prepare and stimulate the reservoir rock to optimally produce hydrocarbons into the wellbore. Finally, the area above the reservoir section of the well is packed off inside the casing, and connected to the surface via a smaller diameter pipe called tubing. This arrangement provides a redundant barrier to leaks of hydrocarbons as well as allowing damaged sections to be replaced. Also, the smaller diameter of the tubing produces hydrocarbons at an increased velocity in order to overcome the hydrostatic effects of heavy fluids such as water.
In many wells, the natural pressure of the subsurface reservoir is high enough for the oil or gas to flow to the surface. However, this is not always the case, especially in depleted fields where the pressures have been lowered by other producing wells, or in low permeability oil reservoirs. Installing a smaller diameter tubing may be enough to help the production, but artificial lift methods may also be needed. Common solutions include downhole pumps, gas lift, or surface pump-jacks (e.g., the "nodding donkey" pumps dotting the countryside in old oil fields in Texas and Oklahoma). The use of artificial lift technology in a field is often termed as "secondary recovery" in the industry.
The production stage is the most important stage of a well's life, when the oil and gas are produced. By this time, the oil rigs and workover rigs used to drill and complete the well have moved off the wellbore, and the top is usually outfitted with a collection of valves called a "Christmas Tree". These valves regulate pressures, control flows, and allow access to the wellbore in case further completion work needs to be performed. From the outlet valve of the Christmas Tree, the flow can be connected to a distribution network of pipelines and tanks to supply the product to refineries, natural gas compressor stations, or oil export terminals.
As long as the pressure in the reservoir remains high enough, this Christmas Tree is all that is required to produce the well. If the pressure depletes and it is considered economically viable, an artificial lift method mentioned in the completions section can be employed.
Workovers are often necessary in older wells, which may need smaller diameter tubing, scale or parrafin removal, repeated acid matrix jobs, or even completing new zones of interest in a shallower reservoir. Such remedial work can be performed using workover rigs—-also known as pulling units-—to pull and replace tubing, or by the use of a well intervention technique called coiled tubing.
Enhanced recovery methods such as waterflooding, steam flooding, or CO2 flooding may be used to increase reservoir pressure and provide a "sweep" effect to push hydrocarbons out of the reservoir. Such methods require the use of injection wells (often picked from old production wells in a carefully determined pattern), and are used when facing problems with reservoir pressure depletion, high oil viscosity, or can even be employed early in a field's life; in certain cases—-depending on the reservoir's geomechanics--reservoir engineers may determine that ultimate recoverable oil may be increased by applying a waterflooding strategy early in the field's development rather than later. The application of such enhanced recovery techniques is often termed as "tertiary recovery" in the industry.
Finally, when the well no longer produces or produces so poorly that it is a liability to its owner, it is abandoned. In this simple process the wellbore is filled with cement so that the flowpath from the reservoir to the surface is plugged.
 Types of wells
Oil wells come in many varieties. By produced fluid, there can be wells that produce oil, wells that produce oil and natural gas, or wells that only produce natural gas. Natural gas is almost always a byproduct of producing oil, since the small, light gas carbon chains come out of solution as it undergoes pressure reduction from the reservoir to the surface. Unwanted natural gas can actually be quite a disposal problem at the well site. If there is not a market for natural gas near the wellhead it is virtually valueless since it must be piped to the end user. Until recently, such unwanted gas was burned off at the wellsite, but due to environmental concerns this practice is becoming less and less common. Often, unwanted (or 'stranded'--gas without a market) gas is pumped back into the reservoir with an 'injection' well for disposal or repressurizing the producing formation. Another solution is to export the natural gas as a liquid. Of course, in locations such as the United States with a high natural gas demand, pipelines are constructed to take the gas from the wellsite to the end consumer.
Another obvious way to classify oil wells is by land or offshore wells. There really is very little difference in the well itself; an offshore well simply targets a reservoir that also happens to be underneath an ocean. Also, due to logistics, drilling an offshore well is far more costly than an onshore well. By far the most common type of well is of the onshore variety. These wells dot the Southwestern United States, and is also the most common type of well in the Middle East.
Another way to classify oil wells is by their purpose in contributing to the development of a resource. They can be characterized as:
- production wells when they are drilled primarily for producing oil or gas, once the producing structure and characteristics are established
- appraisal wells when they are used to assess characteristics (such as flowrate) of a proven hydrocarbon accumulation
- exploration wells when they are drilled purely for exploratory (information gathering) purposes in a new area
- wildcat wells when a well is drilled, based on a large element of hope, in a frontier area where very little is known about the subsurface. In the early days of oil exploration in Texas, wildcats were common as productive areas were not yet established. In modern times, oil exploration in many areas has reached a very mature phase and the chances of finding oil simply by drilling at random are very low. Therefore, a lot more effort is placed in exploration and appraisal wells.
Lahee classification 
The following is a quick comparison of average well costs for the UK Continental Shelf (UKCS). These costs exclude testing (e.g., flow rate testing), and are based on values from March 1998. Prices have doubled since then :
|Well location||Typical cost (in millions of £)|
|Northern North Sea||8–12|
|West of Shetlands||5–15|
|Southern North Sea||7–12|
The cost of an offshore well depends strongly on the remoteness of the location being drilled. Hence the Irish Sea (shallow water, close to the coast) is cheap in comparison to the West of Shetlands (deep water, far from the coast and other facilities). The 2006 cost of a Central North Sea high pressure, high temperature well is about $35-50 million. Deep water wells in the Gulf of Mexico can cost over $100 million. 
Onshore wells can be considerably cheaper, particularly if the field is at a shallow depth. Here costs range from less than $1 million to $15 million for deep and difficult wells.