>it looks at DNS
It looks up gmail.com yes, but how it works out where to send it to is to look at gmail.com's MX records.
These can be found by going into a DNS tool such as mxtoolbox.com
http://www.mxtoolbox.com/SuperTool.aspx?action=mx%3agmail.com%2cAs you can see Gmail has 5 of these MX records at the present. These are:-
5 gmail-smtp-in.l.google.com
209.85.222.34 3600
10 alt1.gmail-smtp-in.l.googl
e.com 209.85.217.17 3600
20 alt2.gmail-smtp-in.l.googl
e.com 74.125.93.27 3600
30 alt3.gmail-smtp-in.l.googl
e.com 216.239.59.27 3600
40 alt4.gmail-smtp-in.l.googl
e.com 209.85.220.66 3600
The reason there's more than one is resilience. Your email will be passed to the one marked 5 first. If that server is unavailable it will be passed to the one marked 10, etc. until it is accepted.