Air traffic control has a pretty good picture of where all the airplanes in the sky are. The technology for finding airplanes is remarkably complex and varied and is in the middle of some significant upheaval. Plane location tech has been under development 50+ years and is slowly evolving from a centralized, radar-based system to a peer-to-peer GPS-based system. It's kinda neat.
Radar is the primary way ATC finds planes. Tracon facilities have a network of radar installations, each updating every 5 seconds with a range of roughly 60 miles. Radar tells ATC where something is but not what it is. So to augment radar, most planes also actively transmit data with a transponder.
Most little airplanes have a Mode A/C transponder operating at 1030/1090MHz responding to broadcast queries with a simple digital encoding. Mode A queries are answered by the plane with a 12 bit squawk code. I usually fly with the anonymous code 1200, but if I'm getting ATC services they assign me a unique code. A Mode C query is answered with an altitude reply to the nearest 100 feet. (Awkwardly, there's no distinguishing a Mode A reply from a Mode C other than context). Mode A/C responses were designed to be received solely by ATC, controllers verbally tell pilots where other planes are. Recent fancy TCAS systems can listen in on the transponder traffic to show plane locations in the cockpit, there's even inexpensive portable receivers for mode C data.
Mode S is the current state of the art used by commercial aviation. It's 1030/1090MHz as well but with 20 or so different responses of up to 112 bits each. Planes can be individually queried by their unique 24 bit address. Planes also can continuously broadcast their GPS position and velocity on an extended squitter. Mode S equipped planes usually receive TIS data from the ground which basically lets the pilot replicate the plane location display the controller has.
The new hotness is UAT, a system designed around peer-to-peer communication and flexible data protocols. Planes broadcast their GPS position and velocity for reception by anyone. Other planes and ATC listen in. UAT also includes significant data services like weather radar images. UAT is still not quite finalized, but the FAA has a plan for coverage.
An interesting alternate technology is FLARM, an unofficial transponder system developed by enthusiasts in Europe. Basically glider pilots got sick of waiting for someone to make a collision avoidance system that'd be cheap and light and low power, so they built their own. It's conceptually similar to ADS-B but simpler and has been a rare hacker-style success in avionics.
Mode S and UAT are two implementations of ADS-B, the FAA's big plan for the future of ATC. There's a lot of politics about the two competing techs: UAT is newer but commerical airlines already implemented Mode S and don't want to pay to upgrade. A final ruling is overdue but it looks like the FAA is going to bless both systems with ground repeating stations translating data.
The interesting thing to me about this is how we're slowly moving from a ground-based surveillance design to a cooperative peer-to-peer system. (The shipping industry is ahead of aviation, with some pretty cool apps). A key enabler of this transition has been better radio signal technology so that little planes can be two way communication nodes in an airborne network. GPS is also essential, knowing exactly where you are is a big deal. There's a lot of ugly detail in the specifics, but those details are interesting responses to limitations of older technology.
Thanks to Wikipedia's aviation community, their articles are good