The answer to that comes in 3-parts:
- In the long term, the HTML5 Geolocation APIs are going to be the preferred way of handling this. There is very limited browser support for this already, fx Google Chrome 5 and Firefox 3.6 support draft versions of the spec now.
- IP location databases such as Maxmind, now being suppleanted by IP location services. There are a couple of providers who will sell you an IP address to location map. These are imperfect, but even so, they probably get it right more than 95% of the time. The next wave of this will be online services that use multiple data points, such as wireless LANs in the neighborhood and GPS if available, to provide better precision. An example is Google Geolocation API (currently only available through Google Gears) or SimpleGEO (trying to be a geo-marketplace and not just location lookup).
If you're just starting out, I would suggest just asking the user with an unobtrusive form. It is the simplest solution, it works, and it does not have any dependencies on browsers or 3rd party services.