How Caller ID Works
Caller ID service in the United States is a simple one or two line readout of the caller's phone number and name, intended primarily for retail consumers. The service used by police and government organizations to get unblocked and accurate caller information is called ANI (Automatic Number Identification). ANI is an entirely separate service, which is also be used for communicating the same number data between phone carriers for billing purposes. As you can imagine, it is far more precise and accurate than caller ID.
When you (known as the 'calling party') place a call to someone else (called party), your local switch digitally sends a CPNM (calling party number message) which contains your phone number and a flag indicating the number's visibility to the called party. If you blocked the number with *67, the tag will prevent your phone number from being displayed, and all that will be shown is PRIVATE CALLER.
Next, the called party's receiving switch queries their own subscriber data for a match. If a match is not found, they query one of the national CNAM (caller name) databases. If that returns a match, the switch sends up to 15 characters of the person's name between the first and second rings.
There's an important distinction to keep in mind here: The caller's phone company sends the number, but the phone company of the person receiving the call is responsible for looking up the name if the subscriber pays for caller ID. Competing phone companies don't so much "share" this information, but rather pay a small fee every time they do a lookup, which is covered by the cost of their caller ID service.
On landlines, a very simple 1200 baud modem is used to interpret the tones sent by the switch and parse them into what you see on your caller ID. This system worked great when there were very few carriers and most people had landlines. Today we have a much different world, with far more cell phones and VOIP users. In those cases, the called party will often not get a CNAM, and caller ID may show just the number, or the number and the state, WIRELESS CALLER, or nothing at all.