a combination of Google Analytics, Google's AdSense, and Google's AdWords. All of those are Wikipedia links.
All other search engines use similar techniques.
So in answer to your question, "how can a web site you have never visited know what products you have shown an interest in?", in fact those web sites don't know, but as soon as you visit he web site the page you land on can 'acquire' advertising that might be appropriate to you. That web site won't even retain that information when you leave, it won't need to. If you visit again it just uses the same method to pull down advertising.
I am familiar with advertisers tracking me and display target ads on websites. If I search products on Cnet, Google and Yahoo, I might see related product ads displayed when I visit Cnet, Google and Yahoo sites later.
A few days ago, I visited a website that I have never visited before. A site that I do not expect to know my browsing habits at all. I was surprised to see that it displayed ads for a product that I searched within last few days.
How does that website that I never visited know which product I am interested in? Or it is the advertisers who put these ads/links in there. If third parties are posting target ads on well known sites, how safe is it to click an ad on a well known reputable websites?
Thanks. EK, Los Angeles, CA.