What is the blue wire on the end of my wire harness for?

It is an auxiliary wire typically used to connect the reverse lights from the tow vehicle to the reverse lockout solenoid located directly behind a surge brake actuator. When properly connected it allows you to disengage the trailer brakes in order to back the trailer up (without getting out of the vehicle). It is primarily used when the trailer axles have disc brakes in combination with a surge brake actuator.