When someone (a registrant) registers a domain, they have to provide the company that manages the domain (the registrar) with contact information and keep it updated. If they don’t, the website may be suspended or taken down. When you use the WhoIs search function, it returns whatever available information there is about “who is” responsible for the site, though some details, particularly contact information, may be private and won’t appear in the results for every site.