To understand how domain names actually work, we will take a look at what happens when you enter it in your browser.
When you enter a domain name in your web browser, it first sends a request to a global network of servers that form the Domain Name System (DNS).
These servers then look up for the name servers associated with the domain and forward the request to those name servers.
For example, if your website is hosted on Bluehost, then its name server information will be like this:
These name servers are computers managed by your hosting company. Your hosting company will forward your request to the computer where your website is stored.
This computer is called a web server. It has special software installed (Apache, Nginx are two popular web server software). The web server now fetches the web page and pieces of information associated with it.
Finally, it then sends this data back to the browser.