DNS stands for Domain Name System. It acts like a phone book that translates website names (like example.com) into IP addresses (like 192.0.2.1) so your computer knows where to go.
The DNS lookup starts at your computer, goes to the local resolver, then root servers, then TLD servers, then authoritative servers, and finally back to your computer with the IP address.
An A record maps a domain name to an IPv4 address. MX records are for mail servers, CNAME for aliases, and TXT for text information.
The hosts file is a local file on your computer that can map names to IP addresses and override DNS lookups. DNS is a distributed system used globally.
If DNS cannot return an IP address, it often means the DNS server is not responding or your computer cannot reach it. The website server being off would cause a different error after IP resolution.