It's a combination of CPC and CTR - it's been mentioned that it's quite possibly CPCxCTR.
This subject has been discussed in this forum many times, so a site search would net you a lot more detail. But briefly, here is how position is determined on the right hand side, and for the top two spots above the search results.
On the right:
Your Maximum CPC and your CTR are weighted equally. Max CPC x CTR = Rank Number. Your rank number as compared to the rank number of your competitors, in the moment of a search, determines position.
At the top:
Your actual CPC is more important than your Maximum CPC, and your CTR is weighted more heavily than CPC.
So, going to the top is more a function of how relevant users find your ad to be (CTR), than what you pay (CPC).
Hope that helps.
AWA