They have databases that they look up, but they're notoriously inaccurate. If you can use a number from another country (not always possible since some services require an in-country number, but a surprising number don't) you'll often find it works better, especially if you choose a country where the database provider might have less access to information about which ranges are assigned to which providers.