Not really based on a user’s IP.
Based on BGP peer routing, so it’s actually physical location of users/ISP/trunks etc, and how they connect to the rest of the world networks.
The geographically local data center can announce a shorter route for a specific IP (block) than a data center on the other side of the planet, so the packets get routed to it