why does my phone charger rapidly click when I unplug it?

No, need to go into great detail about electronics as I likely will not understand it. But, there is a faint rapid clicking noise (not fast enough to be a buzz) of about 5 Hz.

Is this some capacitor discharging? If it can be easily explained to someone untrained in the field, can you tell me why it does this?

It’s hard to say without knowing what is inside your charger.

Larger power supplies will sometimes have relays in them which can click repeatedly as the voltage drops and the coil no longer has enough energy to hold the relay closed. Small phone chargers don’t usually have relays in them, though.

My guess is that it’s the voltage regulation circuit. The energy is coming from a capacitor which is slowly discharging, and that energy is feeding into the voltage regulation circuit, which is the circuit that tries to keep the output voltage of the charger constant no matter how the input voltage changes.

Your basic el-cheapo, low power, wall-wart type of power supply often will not include a voltage regulator circuit, or if it does have one, it will be a simple linear voltage regulator. That’s fine for low power applications, but as you need more power, linear voltage regulators put out a lot of waste heat.

For higher power levels, a power supply will often have a switching regulator, which basically switches the output at high speed to keep the output voltage at the desired level. The transistors in the switching circuit tend to switch back and forth between all the way off and all the way on, which is much more efficient and generates a lot less waste heat than when they are partially on, as they are in a linear regulator. The down side of a switching regulator is that it is much more complicated than a linear regulator, and has more components (and therefore costs more). A phone charger with a higher power quick-charge mode might need the higher power level though, and might therefore have a switching regulator in it.

My guess is that as the charger’s capacitors are discharging, they are feeding just enough power into the switching regulator to get the transistors to fire, which is causing either an inductor coil or a small transformer to have its coils energized. That basically makes the coils act like an electromagnet, and the inductor or transformer can click as the coils move very slightly.

Capacitors can click too, but in my experience the click isn’t as audible. They won’t click while discharging, but a capacitor that is somewhere in the voltage regulation circuit could click as the switching regulator’s chopper circuit fires (it would be momentarily charging and discharging the capacitor, causing the capacitor plates to move slightly, resulting in the click).