IP geolocation databases associate IP address blocks with a geographic location. The data comes from registries, ISPs that publish their allocations, and measurements from users who opt in.
Because an ISP can serve a whole region (or an entire country) from one address block, IP geolocation is only approximate. It is usually accurate to the city level, sometimes only to the country or region level.
For privacy, Know Your Internet only requests location data for public, globally routable addresses, and never stores the results. Treat any IP-based location as a rough indication, not an exact physical address.