Google does it using a technology called "anycast". They use the same IP assigned to multiple machines that are placed around the world. Long story short, the least expensive according to the BGP system, and often shortest path is used.
Normally multiple paths to one IP are exported when multihoming... more than one ISP comes into your network, so there is more than one way to get there. You take the cheapest / fastest path in. With anycast, everything happens the same way, but the different paths lead to physically different machines in far away places instead of just more than one way to the same machine. To the end user, it doesn't matter because the content they get from any of them will be the same.
Because this trick takes having a BGP id and at least a /24 block worth of addresses that you won't be able to use for anything else, you probably won't use their solution. You can contract this out for static content via Akamai Technologies, and probably several other companies as well. I don't know if any providers will handle dynamic content in that way.
You can use a service such as MaxMind's GeoIP as well. That may be the most cost-effective, but you'll have to do some upfront coding to redirect your users based on checks against the IP data. Note that they do offer a free database, and for the country-level direction, that's probably good enough. Disserman's BIND patch idea may also work out just fine, using DNS replies to direct people instead of redirects. This could get confusing for some very technical users, or when debugging strange issues where different hosts think the same name points different places.