Spying, is the act of obtaining secret or confidential information without the permission of the holder of the information. The person who provide this service for fee is called private detective.
They collect useful information from various sources, then they provide it to the client for a fee. They are normally hired to do specific job of collecting information of the targeted person.
On the other hand, these private detectives may take help of Data Brokers.
Data Broker: Excerpt from wiki article explains it in detail:
An data broker or information broker collects information about individuals from public records and private sources including census and change of address records, motor vehicle and driving records, user-contributed material to social networking sites, media and court reports, voter registration lists, consumer purchase histories, most-wanted lists and terrorist watch lists, bank card transaction records, health care authorities, and web browsing histories.
If you're looking for someone who knows a lot about others, he's the right person, he's private detective.
Though, they don't have information of the targeted person before hand. After you hire them, they collect information of the targeted person for you.
Hope it is helpful!