The path a DNS query takes
Resolving a domain name to an IP address walks down a hierarchy. The stub resolver on your device asks a recursive resolver (often run by your ISP or a public service). If the answer is not cached, the recursive resolver queries a root name server, which directs it to the relevant top-level domain server (for example the .com servers). The TLD server points to the domain's authoritative name server, which returns the actual record.
The recursive resolver does the legwork of following these referrals; the client only ever talks to the recursive resolver.
Caching and time to live
To avoid repeating this walk for every lookup, answers are cached at multiple layers with a time-to-live value set by the domain owner. A short TTL allows faster propagation of changes but increases query load, while a long TTL reduces lookups at the cost of slower updates. This caching is why DNS changes can take time to appear everywhere.