Google Ads bidding works similarly to an auction. Every time a search is made in Google, the search engine will look among its advertisers for a keyword match. If Google finds that one or more advertisers are bidding on keywords that it thinks are relevant to that particular query, the auction begins, and all the advertisers that are bidding on such keywords participate on the auction.
From within all these participants, Google ignores the ones that are not obviously elegible -like those that target a different location. From the lesser left, Google chooses the ones with the highest Ad Rank to show: at the the top, the ad with the highest Ad Rank, the second position goes to the ad with the second highest ad rank, and so on.
The Ad Rank formula is as follows: Ad Rank=CPC Bid X Quality Score.
And your Quality Score is composed of these 3 key factors: your ad relevance, your landing page experience (for the user), and expected CTR (click-through rate).