It's Akamai DNS 'magic' determining where to send the client to get the request.
As I understand it (after having a discussion with an Akamai network architect at an IP-Peering meeting) Akamai's DNS uses shortest path routing (typically BGP) from the enquiring DNS client to determine where the closest location is and provides that IP Address.
The DNS protocol defines how a client requests an address and howw a server provides it. Just as a web server can provide a different resource according to the client requesting it, a DNS server can be written that can also do the same thing.
Internet Routing typically works on Border Gateway Protocol (BGP) where Autonomous Systems (identified by AS numbers) exchange information about which subnets are controlled by which system. When determining how to route to an IP address routers typically choose the route which passes through the smallest number of Autonomous Systems.
So an Akamai DNS server receving a DNS request for a resource hosted at Akamai has the IP address of the requesting client. This can be looked up in their internal database to determine which of the Akamai servers is 'closest' (in terms of the IP route) to that address and so the client can then return the address of the 'closest' server.
After having this conversation I did some trial lookups from different subnets and what I noticed was the first lookup typically took significantly longer than a 'normal' DNS lookup. Presumably this was because the system was looking up how to route to that address. Subsequent lookups were as fast as usual, presumably because the answer is cached.
Extra information (how DNS works)
When a DNS client requests a name from a DNS server the server will either provide the name if it is authoritative for that domain, or it will look it up on other servers (if it is configured to be recursive) or it will provide a previously cached answer. The global 'root' servers allow DNS servers to locate the DNS servers which are authoritative for any par5tcular domain so they can direct a recursive query.
DNS servers do not contain mappings for all addresses on the Internet - that would be impossible to maintain and people who operate domains need to be able to change their own DNS records.
Normally DNS servers are either authoritative or recursive (not usually both). When looking up the address for a name which has a CNAME record the client then needs to lookup the IP address that the A record pointed to by the CNAME record has. So if you have CNAME records pointing at Akamai edge servers then it will be the Akamai doamin that needs to be queried as the Akamia domain servers are authoritative for that domain.
When the request comes to the Akamai server it can lookup any information it wants to in order to work out what IP Address to return. As they have an extensive peering (BGP connected) network they will work out which edge server is best placed to provide the data based on the shortest route between the edge server and the origin of the DNS query.
If the query is being made by a DNS server doing a recursive lookup then it may cache the answer, but as it would request the result with the same IP Address in the future it would normally get the same answer so this is not a problem. Akamai can set how long the record should be cached for in their response providing the address (although a server may choose not to follow their direction with regard to cache lifetime).
As most clients have addresses resolved for them by a DNS server that's part of the same AS the routing length (number of different AS's involved) is the same for the DNS server looking up the address and the actual client machine that wants the address.