How GPS Knows Where You Are
Your phone does not send a signal to a satellite and wait for an answer. It listens. About thirty satellites orbit Earth at a height of roughly twenty thousand kilometers, and each one constantly broadcasts its position and the exact time the message was sent.
Your phone picks up signals from several satellites. Because radio waves travel at the speed of light, the tiny difference between when a signal was sent and when it arrived tells the phone how far away each satellite is. With the distance to three satellites, the phone can work out a position in two dimensions. A fourth signal corrects the phone's own clock, which is far less accurate than the atomic clocks on the satellites, and allows altitude to be calculated.
Timing has to be very precise. A clock error of one millionth of a second would translate to a distance error of about three hundred meters.
Here is where relativity matters. Satellite clocks run slightly faster than clocks on the ground because they experience weaker gravity, and slightly slower because of their speed. The net effect is about thirty-eight microseconds a day, and without correction, errors would pile up to kilometers within a day.
The system is run by the United States, which is why people say GPS, but other countries have their own, including Russia's GLONASS, Europe's Galileo and China's BeiDou. Most modern phones use several at once.