The trailer brakes I have seen worked as follows:
Hydraulic master cylinder attached to towing socket. When the car brakes, a force is applied back to the master cylinder, which acts on drum brakes on the trailer wheels. Thus preventing the momentum of the trailer pushing the back end of the car round (especially on corners).
There was also a cable that is under tension, attached to the towbar on the car. If this tension is released (e.g. by the trailer coming unhitched) then the brakes apply on the trailer, thus reducing the potential for damage.