
The basic idea — trilateration, not triangulation
Each GPS satellite broadcasts a continuous signal that says, in effect, 'I am satellite #17, my position is X, my onboard atomic clock reads T.' Your receiver knows the speed of light. It compares the satellite's timestamp with its own clock, multiplies the difference by the speed of light, and gets a distance to that satellite.
One distance puts you on a sphere. Two distances narrow it to a circle. Three distances narrow it to two points (one of which is in space). A fourth satellite resolves the ambiguity and corrects your receiver's clock error, which is the trick that makes the whole system work on cheap consumer hardware.
Why your phone doesn't need an atomic clock
An atomic clock costs more than a car. Your phone has a $0.20 quartz oscillator. The clever part of GPS is that the receiver treats its own clock error as a fourth unknown and solves for it using the fourth satellite. The math falls out as four equations in four unknowns (x, y, z, t).
The relativity correction
GPS satellites orbit at 14,000 km/h. Special relativity slows their clocks by about 7 microseconds per day. They also sit 20,000 km above Earth in weaker gravity, which speeds them up by about 45 microseconds per day. Net: their clocks run 38 microseconds per day faster than ground clocks. Uncorrected, GPS would drift by 10 kilometres a day. The correction is baked into the satellite firmware.
Civilian vs military precision
Civilian GPS is accurate to about 3-5 metres horizontally with a clear sky view. Survey-grade GPS using differential techniques reaches centimetre accuracy. Military P(Y) code is encrypted and gives sub-metre precision. Modern phones combine GPS with GLONASS (Russia), Galileo (EU), BeiDou (China) and inertial sensors for indoor estimates.