Here's how an IP address alone can tell you roughly which country or city someone connected from โ and where that estimate breaks down.
How IP geolocation works
Databases are built from records of which ISP was allocated which IP ranges in which region, then an IP is matched to a rough geographic location based on that. It's not a GPS-precise coordinate โ more an estimate of "this IP belongs to this regional ISP."
The limits of accuracy
Country-level accuracy is usually high (90%+), but city-level accuracy is far less reliable, since an ISP's data center location can differ from the actual user's location. A VPN or proxy produces a result completely unrelated to the real location.
Practical uses
This is used for rough regional visitor statistics on a website, for pre-testing before blocking access from a specific country (geoblocking), and as one signal (among others) for flagging a login attempt from an unusual location.