If I have multiple A records for the same DNS name (i.e. example1.com has two A records of 22.214.171.124 and 126.96.36.199) and for example one server is located in Canada and the other is located in Hong Kong, will the visitor's ip address and physical location automatically be used to direct them to the closest physical ip address? If one server goes down, will requests automatically be rerouted to the other server? If this is not the case, what are some good solutions to make this happen? I'm hoping that the "Internet" and all of it's routers and DNS servers are smart enough to at least go to the closest ip address...
The case you describe is called "round-robin DNS". Client PCs will pick a random IP address from the pool that are returned to it. It is not smart like you hoped.
The kind of service you're looking for is a DNS server that does a GeoIP lookup of the incoming request and serves an IP address closest to the requesters location. There are 3rd party DNS providers that support this, I believe.
The problems you are trying to solve are separate, but related. Specifically, you are attempting to achieve the following two things:
- High availability
Load-balancing is distributing user requests across different servers. The way that users are distributed across servers can vary. To give but two examples:
- round-robin - alternate between your two servers for every request
- least-connections - have your load-balancing device keep track of how many connections each server is handling, and send new requests to the least loaded server
In this case, you want users to be directed to the server 'closest' to where the request is coming from. As mentioned in other answers, various DNS providers offer this service, as do DNS servers such as BIND.
High availability refers to ensuring that if one of your servers is no longer available that users are directed to an alternative. A common way of doing this is through the use of IP anycast; however, in order for this to work, your hosting provider must be willing to accept routing advertisement from you, among other things. See this question for a more in-depth discussion of anycast.