Google adwords works on bidding system. Advertisers bid on the keyword they want to target. If the bid is high, your ad will appear on top of the page.