Advertisers set a bid for each keyword, and the ad order is decided by the bid and ad quality. It is a CPC (cost per click) model, so there is no charge if the ad is shown but not clicked.
Some industries, such as clinics, have separate rules for ad copy, so search ad copy must also follow the industry's advertising rules.