Merkle interview question

How do search engines rank ads?