A futures contract is simply a financial instrument that allows for the trade of a good at a future time. The futures market was born out of a desire from producers and users of a good to hedge risk, but is also a tool for speculators to make bets on the price of the good. This is most obviously seen in that amount of oil represented by futures contracts traded daily greatly exceeds the actual global demand for oil. Large increases in oil prices are often blamed on this speculation, an assertion that I will partially address.  That futures markets play a large role in price determination for commodities is, on the other hand, well accepted.  This paper describes the basic mechanics of futures markets with a focus on its effects on the oil market.
A futures contract is simply an agreement between a buyer and a seller to exchange specified goods at specified time for a specified price. These contracts are standardized such that contracts of a specific type and settlement date are identical to one another. They trade on exchanges that provide as an intermediary between the two parties. This standardization allows one party to exit the agreement simply by selling (or buying to cover) the contract to (from) another party via the exchange. Each contract specifies the underlying good, the quality of the good, the price at which the exchange will take place, the delivery date, and the method of settlement.
The method of settlement will specify where and when the goods will be delivered. Contracts may also allow for the settlement to be made in purely monetary terms, with the two parties exchanging cash as opposed to actual goods. 
Futures on exchanges are only available on goods that are fungible. That is, goods that can be substituted for goods of the same type. Corn, wheat and oil for example qualify while houses and paintings do not. The futures contracts are very specific about the quality of the underlying good and often there are many different contracts available for the same type of good. Light sweet crude (the most heavily traded crude oil), for example has a low density (light) and low sulfur content (sweet).  For an exchange to offer futures for a specific good, there must be adequate customer demand for those futures.
The graph of futures prices versus their delivery date is known as the futures curve. If the curve is sloping upward, meaning that future prices are higher than the spot price, the commodity is said to be in contango. If it is sloping downward, with lower prices in the future, it is in backwardation.  Naively we should expect the market to typically be in contango due to the cost of storing oil and natural price inflation . Typically, however, we find that the oil futures are in backwardation.  This is thought to be due to a couple factors. First, because oil is just kept in the ground, storage costs are very low. Second, leaving the oil in the ground gives the owner optionality on its production. If prices are higher or production costs are lower in the future, the oil can be produced and sold then for larger profit. Conversely if there is less profit to be made the owner can continue to store the oil. The backwardation in the market thus provides the balancing incentive for producers to produce now as opposed to later. .
As the delivery date approaches the price of the contract approaches the spot price, or the price that the underlying good could be purchased for on the open market. The reason for this is simple arbitrage. If the price did not converge, an arbitrageur could so simply buy/sell the contract and sell/buy the good, and pocket the difference. 
Futures contracts are useful because they allow both the producer and user of a commodity to lock in costs in advance, and thereby reduce the risks posed by fluctuations in price of that commodity. An example of how a futures contract can be useful comes from the airline industry. A large portion of the cost of making a flight comes from buying jet fuel. The tickets for the flight are typically sold months in advance of the flight. Increases in the price of jet fuel between the time that the tickets are sold and the time that the jet fuel is purchased can thus cause risk of operating loss to the airline. If jet fuel prices drop however, the airline can make a larger than expected profit. Typically though, a business would prefer to operate without this uncertainty. The simple fix to this problem is for the airline to purchase the jet fuel when the tickets are sold and then store it until needed. This is a costly solution. Alternatively, the airline could hedge the risk by buying futures contracts for the fuel needed. Realistically, contracts for the specific type of fuel needed delivered to the right location probably do not exist. The price of jet fuel though may rise and fall in lock step with the price of Brent crude oil. The airline could buy Brent crude futures and then the change in value of the futures contract would offset any changes in the spot price for jet fuel.
A producer of jet fuel, on the other hand, may want to hedge against the price of oil declining. Large capital expenditures are required to extract and process oil. The producer wants to ensure that the resulting fuel can be sold at certain price so as to make an appropriate return on investment. This is of course a specific example and every party will have their own reason for using a contract.
While initially developed as a tool for hedging, the futures market has attracted speculators. Because it is not necessary to actually use or produce a commodity to participate in the futures market, it is possible to place bets on the price direction of a commodity. If someone had some special insight into commodity prices, through inside information or superior analysis of available information, they could make large amounts of money. The futures market though is a zero sum game. For every dollar won a dollar is lost somewhere else. 
While speculation may seem pointless, it does add value to the system. As mentioned previously, far more oil is traded on futures exchanges than actually consumed.  Nearly all of these contracts are cancelled through offsetting transactions, as they must be. The sheer volume of trading though increases the liquidity of the market, increasing the ease of buying and selling. Speculators, in their effort to make a profit, will discount known information into the price of the futures contracts. If it is known, for example, that some large source of oil will come online in one year increasing supply and driving down the spot price, speculators will sell contracts until the futures price fairly reflects the expected future spot price. These two factors allow the market to be more efficient. 
In reality, the line between speculators and hedgers is not so precise. The reasons for buying and selling contracts are often some incoherent superposition of the two. Speculators often use futures to hedge some other position and hedgers may attempt to profit from their inside knowledge of the market. [6,7]
When commodity prices rise sharply, there is often political backlash against speculators, blaming them for price movements that do not reflect the true supply and demand equilibrium.  This is particularly true for crude oil as the as the movements of the spot price can be observed at every gas station. I do not attempt here to answer whether or not speculation causes the price of oil to deviate from its fair value for reasons I will discuss below. However, I will point the reader to further debate about the role of speculation in the market.
The reasons I remain agnostic on this question are twofold. First, fair value independent of the market spot price is not well defined in this context. Due to the integration of oil prices into the financial world through futures exchanges, it is easy to think of oil as an asset akin to stocks and bonds. It is, however, fundamentally different. The value of a security (stock or bond) is equal to the sum of the cash distributions of the security, discounted back to the present. The expected cash flows and degree of discount required are of course hotly debated.  Oil derives its value as a consumable and not from cash flows. It has value because people want to use it. Thus, I do not have a working definition for value apart from the market price.
Second, controlled experiments are not available in the world of macroeconomics. We can only observe the past and when new economic events occur, it is impossible to isolate the effects of those events. There is no control earth to which we can compare to establish cause and effect. It is therefore impossible to say with certainty whether or not speculators cause larger than natural price swings.
Arguments have been the assertion that the increase in oil prices into 2008 was an asset bubble caused in part by speculation. It is possible that uncertainty in the market fueled speculation and caused a bubble as evidenced by faster than exponential price growth.  Or, the speculative hedging by institutional investors could have caused a positive feedback cycle from commercial hedgers closing their short positions.  Alternatively, the run up in price could have been the natural result of increased demand from emerging economies.  My goal is to have provided enough information in this paper to enable the reader to independently judge the merits of these arguments.
© David Berryrieser. The author grants permission to copy, distribute and display this work in unaltered form, with attribution to the author, for noncommercial purposes only. All other rights, including commercial rights, are reserved to the author.
 P. Krugman, "The Oil Nonbubble", New York Times, May 12, 2008.
 M. Levinson, Guide to Financial Markets, 5th Edition (Bloomberg Press, 2009).
 P. Almiead and P. Silva, "The Peak of Oil Production - Timings and Market Recognition" Energy Policy 37, 1267 (2009).
 R. H. Litzenberger and N. Rabinowitz, "Backwardation in Oil Futures Markets: Theory and Emirical Evidence," J. Finance 1, 1517 (1995).
 E. S. Olson, Zero-Sum Game: The Rise of the World's Largest Derivatives Exchange (Wiley, 2010).
 L. L. Johnson, "The Theory of Hedging and Speculation in Commodity Futures," Rev. Econ. Studies 27, 139 (1960).
 S. Das, Extreme Money: Masters of the Universe and the Cult of Risk (FT Press, 2011).
 A. Damodaran, Investment Valuation, 2nd Ed. (Wiley, 2001).
 D. Sornette, R. Woodward and W. Zhou, "The 2006-2008 Oil Bubble: Evidence of Ppeculation, and Prediction," Physica A. 388, 1571 (2009).
 D. Tokic, "Rational Destabilizing Speculation, Positive Feedback Trading, and the Oil Bubble of 2008" Energy Policy 39, 2051 (2011).