Taillights sometimes work, then they both go out, and come back

also, I just spent $180 to find out why my headlights were browning out. behind the brake master the connection to the clyinder came loose an dropped off, telling me my handbrakes was on
I wish that made sense, Wrong post?