Websites and apps use Facebook's Pixel and software development kit (SDK) to collect information about your device and your activity, and send that to Facebook. Facebook uses that information to then show you targeted ads.
It's why people are convinced Facebook must be listening to their conversations since they see ads in their News Feed for the very products or items they were just talking about. Here's a newsflash: Facebook doesn't need to listen to your conversations. It already knows so much about you, it can practically read your thoughts.
If you don't believe me, the "Off-Facebook Activity" tool that Facebook announced back in August is finally available. Go take a look at exactly what Facebook has collected about you. You might be surprised at all of the sites and apps you use on a regular basis who are sharing information about what you do.
Here's how to find out what sites are sending information to Facebook about you. The "Off-Facebook-Activity" tool isn't easy to find (though you can click that link to go directly to it). If you want to navigate there, click on the drop-down carrot in the top right of the desktop version of Facebook. Then select "Settings" and "Your Facebook Information." There you'll find an option for "Off-Facebook Activity."
There you'll find a list of all the sites that are sharing information with Facebook, and you can clear your history (removing this information from your account), turn off tracking for specific sites, or disable this tracking completely. To be clear, if you turn it off, Facebook will still receive information about your activity, it just won't be associated with your account.
Also, turning off this type of data sharing does mean that you won't be able to use Facebook to log in to other apps or sites. Never mind that you shouldn't be using it, for this very reason, but if you are, you'll be logged out and have to create a new login for those accounts or apps.