It’s actually both. The site determines what categories of ads can be displayed, and the viewer profile determines which in those categories will be actually shown.
However, the servers were always crashing and I was always wondering when the customers would figure out that they were throwing money away.
Cookies and/or pixels - edit If you've opted out of being cookied, then you may be "targeted as an balding middle aged man with erectile dysfunction."
Also cause a lot of adtech is not sophisticated.
In terms of what ads to show you, AI not really necessary. Often it's just for stuff you've searched for on Google, amazon etc.