Surveillance RADAR is very useful, and can be augmented like GPS. RADAR alone can only tell range and azimuth. If the transponder is added, the range and azimuth can be augmented with altitude and identification.
Transponders are transceivers, like DME. When the RADAR interrogation is received, the transponder transmits a specific response. For most GA aircraft, the response will be the identification (mode A), and the altitude (Mode C). The transponder concept comes from a technology developed around WWII, used for positively identifying friend or foe targets (IFF). Early targeting RADAR on aircraft could identify targets, but not who they were. Occasionally people will still call a transponder an IFF box.
If the transponder is Mode S, the response will include quite a bit more information. The mode S transponder has a payload capable of holding identification, altitude, and various other information, depending on mode. The message can be 56 or 112 (extended squitter or ES) bytes and include a 24 digit ICAO identifier assigned to each unique aircraft. Location and speed can also be encoded in the response. There are various modes the Mode S transponder will work in. (For a good article that covers much of the ModeS modes, see this EETimes article)
Usually aircraft transponders will transmit on 1090MHz. TCAS receivers and RADAR antennas will all be expecting to receive messages on 1090MHz. The transponder is mostly listening, but can be quite busy in class B airspace, with several TCAS units pinging traffic in the area.
The code that is entered in the transponder is asigned by ATC. There are only 4096 unique codes, and some are reserved (IE 1200, 0000, etc). The numbers are limited to 0-7 or octal digits (octal = 8, and 0-7 are 8 distinct values). Octal is a throwback to early computers that were used for Air Traffic Control, and numbers were represented in octal values. On a busy day, there may be more than 4000 aircraft in the air at once, how does air traffic control keep conflicts out? Certain ranges of transponder (squawk) codes are reserved for local traffic (staying in the area, like training, or ferry flights). Other ranges are for long distance flying, some east, some west, depending on origin and destination. Occasionally, something unexpected happens, and two aircraft with the same transponder code appear in the same area, and the RADAR display will alert the controller to that.
The altitude that all the transponders send is pressure altitude. Pilots will set the altimeter on the ground to local barometric pressure. The altitude encoder attached to the transponder is not adjusted to local barometer. ATC will set their scope to the local pressure. Having ATC consistently reading the same uncompensated pressure will allow more consistent readings aircraft to aircraft. Sometimes pilots will forget to change their altimeter, or set it wrong, and this would cause trouble for ATC trying to figure out what everyone's altitude is. If ATC is saying the aircraft reporting altitude is significantly different than the pilot thinks they are flying, ATC may ask the pilot to stop reporting altitude, and the pilot will switch to Mode A.
Most Mode S transponders are capable or working in Mode A/C or just Mode A as well. Mode S transponders, with their large payloads can be used for ADS/B as well. ADS/B will require other transponders in the area to be sending specific payloads, in order to plot the position on the receiving aircraft's display.
Transponders add a great deal to RADAR. Transponders will stay on aircraft even after the aircraft are switched to ADS/B. Eventually, the need for a transponder will be replaced by the ADS/B system, but that may be many years.