I think you earth out pin 12 in the plug, so if pin 12 in the socket detects earth then it knows that a trailer is attached. It might do clever things like disable the rear foglight or reversing sensors. Just a guess, but could it be really clever and change rear suspension settings? Or am I being futuristic?
Trailer stability function of ESP does not require any electrical connection between the towcar and trailer. Trailer stability (or, more correctly, instability) is detected by sensing the lateral acceleration of the back of the towcar, i.e. TSP detects any "tail wagging the dog". The necessary sensor for this function is on board the towcar.