Telecoms traditionally published the name associated with every landline in the metro area. Local governments publish the names and addresses of property owners, registered voters, and participants in court proceedings.
In old movies, and some newer ones (Spotlight), you'll see the heroes traveling to drab government offices in the middle of nowhere and standing in line for photocopies. Data brokers  in their simplest form are just running this ground game "at scale" and caching the result in a convenient place.
Basic demographic information like you're describing does not require any of the sophisticated conspiracies of modern ad-tech, which is more focused on associating these 20th-century profiles with information about preferences, personality, and even current emotional state in order to bid exactly the right amount to show exactly the right ad at the right time.