From Wikipedia:
http://en.wikipedia.org/wiki/Mobile_phone_tracking
Cell phone tracking tracks the current position of a cell phone. To locate the phone, it must be turned on[1] but does not require an active call. GSM localisation is then done by triangulation based on the signal strength to nearby signal masts.[2]
In order to route calls to your phone the cell towers listen for a signal sent from the phone and negotiate which tower is best able to communicate with the phone. As the phone changes location, the towers monitor the signal and the phone is switched to a different tower as appropriate. By comparing the relative signal strength from multiple towers a general location of a phone can be determined.
A phone's location can be uploaded to a common web site where your "friends and family" can view your last reported position.
Newer phones may have built-in GPS receivers which could be used in a similar fashion, but with much higher accuracy.
Some newer phones and technology may also allow the tracking of the phone even when turned off or, at least, have the microphone activated.[3] Also, phones can have secondary batteries installed to allow tracking even if the battery is removed.