How does Identification Friend or Foe (IFF) work? Are radar images of friendly planes recorded, or do friendly planes have transponders on them?
IFF systems use a transponder/interrogator combination to allow aircraft to issue challenges, receive responses, and do the friend or foe test. BAE Systems has a transponder product page with a little info, and Wikipedia (yeah yeah) has a reasonably thorough description and history of IFF.
According to NATO STANAG 4579 (abstract):