Good question. The answer is in understanding the details. The RIR's
(Regional Internet Registry - ARIN, RIPE, APNIC, ...) do allocate large
blocks as you state, but those large blocks are divided into subnets.
When you realize the subnets have routers and routers often provide
their GPS coordinates, you can see how Geolocation can become more
accurate with more address bits. That's just one of the ways. Another
way would be the subnet assignments often being public and location of
the company/organization with said assignment having a known location.
Still another approach is the looking up locations based on AS/ASN. And
yet another is GPS reporting (think mobile android/ios). There are
probably other ways that I don't know. The important part to realize is
how all of the various methods are both employed and combined to build
out geolocation databases. Geolocation by IP is far from perfect, but
often it can be surprisingly accurate.