As far as I know, these websites gather information from publicly available sources, including government or federal databases. And even if you're cautious about what you share online, there are methods to collect this information, at least in the US. If your goal is solve this problem, there are services like
onerep.com that will walk you through how to opt out of these websites and remove your information.