If the trailer your towing is older or has any kind of rusting issues your most likely loosing a good ground while traveling. When trailer lights are working are any of the bulbs flickering or weaker. If you work on trailer your self you could try running a common ground wire to each light and then back to trailer connector.
Trailer brake ground wires should also be checked and changed to the common ground wire from lights.
Rusting trailer frames and poor contact between body mounts between trailer body and frame will cause this condition.
At least thats what I have found.
06 Titan LE,4x4,Steel Leather,Red Alert,Big Tow,Factory Step Rails,Brush Gaurd,Floor Mat,Bed Extender.. Add On's- In Channel Window Vent,Rear Spoiler mounted on RollBak Retractable bed cover... 2 Deg Timing Mod.. AirRaid TBS... NISMO Cold Air Intake.. BullyDog GT III and FlowMaster cat back dual exhaust.. Drilled/slotted rotors and Evolution pads front and rear.. JBA headers, rear sway bar.