There are two common mechanisms. The first is DNS based. When a user's browser looks up your domain, the DNS service returns a different IP address depending on where the user is and which regions are healthy. AWS Route 53 and older GSLB appliances work this way. It is simple and works with any protocol, but DNS answers get cached by resolvers and devices, so a failover can take seconds to minutes to fully take effect because old cached IPs keep pointing users at a dead region until the TTL expires.
The second is anycast based. You announce the same IP address from many locations using BGP, the internet's routing protocol. The network itself delivers each user's packets to the nearest location announcing that IP. Cloudflare, Google Cloud's global external load balancer, and AWS Global Accelerator use anycast. Failover is faster because rerouting happens at the network layer in seconds, and there is no DNS cache to wait on.
Both approaches lean on continuous health checks. The balancer probes each region's endpoint every few seconds, and a region that fails its checks is pulled out of rotation. Routing decisions can be based on geography, measured latency, weighted percentages, or capacity headroom.