Right, brake pad wear sensor. It's intentionally only one side. I'm guessing the assumption is pads wear roughly evenly side to side, an extra sensor would cost more, both in manufacture and in replacement after being worn down.
I assume it's connected at the bulk head and not at the calliper, otherwise you should get a dash brake pad warning. Someone probably left it loose so they would not have to replace it when it wears down. It fits along side the inner brake pad so that the rotor wears it down until the circuit is opened when the pad is nearly worn completely down. I don't recall exactly how it's fitted other than it's readily visible from the top when the wheel is off.
It's kind of dumb to leave it loose, it's much cheaper to replace than a ruined rotor, and if you visually check the pads regularly and replace them before they get fully worn, you can reuse the sensor as long as it has not set off a warning.