All of the major search engines use auctions to price ads. The reason is simple: there are millions of keywords that need to be priced and it would be impossible to set all those prices by hand.

Using an auction removes the burden of having to do this: the prices are determined by the auction participants. These auctions run every time a user enters a query, so they always reflect the current values that advertisers place on keywords.

The outcome of the ad auction is efficient in the sense that the available ad slots are awarded to those who value them mostly highly. The outcome is also equitable in that the price an advertiser has to pay is determined by the other advertisers -- those with whom it has to compete for slots.

But how do they actually work? There are several steps in the process.

1) Each advertiser enters a list of keywords, ads, and bids.

2) When a user enters a query, Google compiles a list of all the ads whose keywords match that query.

3) The list of ads is then ordered based on the bids and the Ad Quality Scores, which measure the relevance of the ad to the user.

4) The highest ranked ad is displayed in the most prominent position, the second highest ranked ad gets the second most prominent position, and so on.

5) If the user clicks on an ad, the advertiser is charged a price that depends on the bid and Quality Score of the advertiser below it. The price charged is the minimum necessary to retain the advertiser's position in the list.

A simple example is when all ads have the same Quality Score. In this case, the ads will be ranked by bids and the price an advertiser pays per click will just be the bid of advertiser below it in the ranking. Hence the amount that advertisers pay is no more than what they bid and typically less.

In the general case, where ad qualities differ, the price an advertiser pays for a click will depend on its Quality Score relative to the quality of the ad below it in the auction. Roughly speaking, an ad that has twice the quality of another ad will tend to get about twice as many clicks, and will only have to pay half as much per click as the competing ad.

Where does this Ad Quality Score come from? It was originally determined by historical click through rates but has been refined over the years using sophisticated statistical models. Using ad quality as a factor in ranking ads provides strong incentives to advertisers to make sure that they provide relevant ads to end users.

There are many additional tweaks on top of this basic design. For example, Google actually runs two auctions: one for ads at the top of the page, and one for ads on the side of the page. Only ads with particularly high quality are eligible to compete in the top-ad auction. Ads that have particularly low quality may be disabled, and not shown at all. Advertisers also can set and adjust their daily and monthly budget so as to cap their maximum spend.

But the essential structure is that outlined above: advertisers bid for position and pay just enough to beat their runner-up. Prices for keywords are, ultimately, determined by the advertisers.