Google AdWords determines the price advertisers pay for clicks in realtime ad auctions on Google Search Engine Results Pages (SERPs). This means with every search query a user submits on Google, an auction takes place.
In this video, Google's Chief Economist Hal Varian explains how the auctions work.
Important to note that Google gives each competing ad an "Ad Rank" that is computed by multiplying its Maximum Bid an advertiser is willing to pay with the Quality Score that Google assigns your ad/keyword/landing page. The higher your ad rank, the higher your ad's position on the SERP.
Ad Rank = (Max Bid) * (Quality Score)
The price you pay (p1) is directly related to the maximum bid (b2) of the advertiser below your ad - though the Quality Score of each ad (Q1 and Q2, respectively) is also taken into consideration.
p1Q1 = b2Q2
Since b2Q2 is essentially the Ad Rank of the ad below your ad, the price you pay is equal to the Ad Rank of the ad below yours divided by your Quality Score.
p1 = b2Q2 / Q1