As with most Pay-Per-Click advertising channels, you essentially bid on a keyword or audience. The platform, whether it be Google, Facebook, or any other, will determine whose ad is best based on both the bid and quality of the ad.