DNS consists of many servers on the internet that work together to deliver requested URLs. DNS servers are distributed throughout the World and they cover billions of names (both IPs and domains). They contribute to deliver requested queries on the Internet. The domain name system is a global network of servers that translate host names like www.google.com into numerical IP (Internet Protocol) addresses, like 18.104.22.168, which computers on the Net use to communicate with each other.
DNS servers use some DNS softwares especially BIND. Each DNS software has two sections: the Name Server and the Resolver. The Name Server is the main part which translates a browser requests (URL) to an IP. When it doesn't know the answer, the Resolver will ask other Name Servers for the requested address.
How DNS works?
When you type in a URL, your browser sends a request to the closest Name Server. If that server has already been requested for the same address within in a certain period, it has the reply. If the Name Server is unfamiliar with the requested domain name, the Resolver sends the query to another Name Servers. If that doesn't work, the second server will ask yet another - until they find an Authoritative Server (A server which supplies an answer without asking another server).
Sometimes, when you write a URL you receive an Error Message that indicates the requested URL has not been found e.g. “Sorry, we could not find http://www.www.google.com”. In this case, if you are sure that your address is correct, then there is another reason. The process of communication between the browser and Name Server is usually very fast but sometimes it might take several seconds to find an Authoritative Server. You might receive the error message because the Authoritative server is slow in replying to the first Name Server and meanwhile the connection of your computer with the Name Server is dropped based on your connection defaults. In the next efforts, there is more chance to open the URL because the Authoritative Server has replied to the first Name Server in this time and the closest Name Server has already stored the requested IP. So your requested IP is available on the closest Name Server.
Resources: BIND9 and iana