It's a familiar scene on cop shows: The detectives manage to get the bad guy on the phone and have to keep him talking until they can trace the call. It might make exciting viewing, but it's not an accurate depiction of how long it takes to trace a phone.
Nowadays, phone calls can be traced immediately, thanks to modern technology. This applies whether a call is made from a landline or a cellphone.
Tracing a Landline Call
As soon as a call is made on a landline, the phone company can track and trace it immediately. This has been the case since the mid-1980s, when the introduction of electronic switching systems replaced automatic electro-mechanical switching systems, such as the crossbar-switching system.
Tracing a Cellphone Call
It is just as straightforward to track and trace a cellphone call as a landline call, due to requirements that cellphone networks feature location-tracking technology, such as GPS (Global Positioning System) chips, to assist 911 services. Rules issued by the Federal Communications Commission in 2015 require wireless telecom companies to provide a "dispatchable location" (a physical address including information such as floor, suite or apartment) to 911 call centers within 30 seconds, regardless of indoor or outdoor location. GPS works by measuring the time it takes a radio signal to travel between one of the many satellites orbiting the earth and a cellphone. This time is used to determine the location of the phone, and it happens almost instantaneously.
Tracing Harassing Calls
To trace a harassing call made from a withheld number, dial *57 after you hang up on the caller (or after your phone stops ringing, if you don't answer it). Listen to the recorded message, which tells you whether the trace was successful or not. You won't be given the caller's information, but if you get three successful traces from the same number, you can contact your local law enforcement agency and explain that you've been receiving harassing calls, which have been traced.
Blocking Caller ID
If you are making a call from a landline, you can dial *67 before the number you are dialing to prevent your information being shown on the receiver's phone display (this is an option on many cellphones in North America, too). This works only on a per call basis, so the process has to be followed each time you make a call. On most cellphones, there is a "My Device" option within Settings that allows you to hide your caller ID. This should also let you call phones that have blocked your number. However, while all of these options hide your information from the person you are calling, they don't stop the phone carrier tracing the call back to you.