Look up a pin diagram on the internet.
Generally speaking, the blue wire from the connector bundle goes to one side of the brake wire and the other side is grounded. The brake-away switch needs it's own little battery and box. The negative on the battery box is grounded. The positive comes out of the box, goes through the break-away switch and T-s into the break wire that you connected into the blue wire from the connector. Next, you need a charging wire from your truck to keep the brake battery charged. It depends on what connector type you are using. Generally it's the red wire from the connector. if your truck isn't set up for this you will need a wire from the battery of the truck (the starter solenoid or something similar) through a fuse, and then to the trailer connector. If that battery on the trailer sits for a month without being maintained it won't work if you need it. After a year the inside of the battery will be lead plates covered with a hard layer of white shit.
The Will method is to use a pintle hitch and in spite of the law, not bother with break-away switches. I have one on my truck but there is no battery. I had a heavy dip entering a gas station pluck the hitchball out of the coupler once and then decided to never use a coupler again. Bulldogs are good, but I have enough to think about without thinking about my trailer being hitched properly. You snap the pintle jaws, throw the trip-lock and put the pin in and the vehicles will be together no matter what.
By the way, the brake magnets can be hooked up either way--there is no positive or negative. One from each magnet will all join together at the blue connector wire and one from each will join together at a good solid ground. Don't skimp on grounding. That's the number one failure in anything related to trailers. Mkae sure the truck-side connector is grounded and the trailer side is grounded. Good grounds too. I grind the paint and use a bolt and nut and a wiring connector. Then I paint it to shield it from oxygen.