IP address to location resolution
They work using various of ways. But starting at the very top (think thousands of acres).. basically top level network providers assign regions of ip addresses to geographical location. They had to take away ip addresses a while back to do this, but it was relatively painless because of DNS (you just assign a different ip to the same domain).. But there are times when that just won't work, because the organization using can't give it up--for security reasons for example--that's why those RSA guys are making so much money, because IP and DNS both can be spoofed--and we need client and server authentication using cryptography to ensure you really are downloading service packs from Microsoft, your CIBC account number isn't going to the bahamas, and your Flash upgrade hasn't been hacked...
IP addresses (or the block that they are in) can be queried with the address space registrars. This information can often be grepped for the address of the registrant.
You can use ARIN.NET to take an IP and find the company that is assigned the block containing that value. For example "joelonsoftware.com is 188.8.131.52. Using whois on ARIN.NET that maps to:
Part of the reason IP pools were assigned with geography and regions in mind is to reduce the load on most routing tables. It's the table used to look up where to send the packet request from your computer to the destination server. Having pools and regions physically mapped helps reduce the processing power and memory requirements of routers a lot.
Fog Creek Home