There are several types of affiliate programs. Most will pay you a flat rate or percentage of the sale you make (pay-per-sale). Another common type is when you're paid per action or lead. For example, if you refer someone who signs up for businesses free trial, the business pays you for the sign-up. Although not seen as often anymore, some will pay you per click (this is seen most in contextual ad programs such as Google Adsense) or per impression (each time the ad is loaded on your website).
There are more than half a billion active websites under the sun and most of the (almost 70%) of them struggle to get traffic due to the high competition and expense of the process like SEO or Digital Marketing. However, you can simple buy targeted traffic from various sources at any time you want! Every paid ad campaign is an attempt to get traffic in exchange of money. However the reasons behind getting traffic are pretty different from each other. Some people buy traffic to get sales, some buy traffic to get leads, some buy traffic for brand exposure, some buy traffic to gain authority and improve rank on several metrics and so more.