Any program on your machine that needs to talk to a name server to resolve a domain name knows what name server to go talk to because it can get the IP address of your machine's name server from the operating system. In that case, the name server can return the IP address immediately. Let's assume, however, that the name server has to start from scratch. A name server would start its search for an IP address by contacting one of the root name servers . The root servers know the IP address for all of the name servers that handle the top-level domains.
Every name server has a list of all of the known root servers.
It contacts the first root server in the list, and if that doesn't work it contacts the next one in the list, and so on. Here is a typical list of root servers held by a typical name server. The formatting is a little odd, but basically it shows you that the list contains the actual IP addresses of 14 different root servers. The root server knows the IP addresses of the name servers handling the several hundred top-level domains. It returns to your name server the IP address for a name server for the COM domain.