X is just the content of the ad and is usually entirely advertiser-defined. Some ad networks will allow you to do some fancy stuff to help determine the best phrasing or arrangement or whatever of your ad.
Z can be in dollars per impression, per click, or per conversion. An impression is one person being shown an ad one time. A click is a person clicking an ad. And a conversion is advertiser-defined but is usually someone buying the product being advertised. Bidding per click is the most common.
Then when a user loads a page with an ad on it, the ad network finds all campaigns that are eligible - meeting the criteria defined in Y. It then runs an "auction". It has to calculate which eligible advertiser is willing to pay the most for that potential impression. But not all advertisers are bidding per impression, so some prediction comes into play. If an advertiser bid per click, then the expected amount they will pay is the probability the user will click multiplied by the price if they do click. Their probability of clicking is often called CTR which stands for "click-through-rate" so that's where the bid * CTR comes from. Usually an ML model takes what is known about the user, the ad, and the page, and predicts CTR. Similarly for conversion-based bids, it's bid * CTR * CVR, where CVR is "conversion rate". Whichever ad comes out with the highest result of this calculation is shown.