One wire is hot for the tail light, the other serves as the brake light and/or the turn signal. It's possible that the bulb is the problem- - - -the ground for both filaments is soldered to the brass base, and if that ground gets broken, the same problem will happen as a bad ground on the socket. Change the bulb first- - - -it might solve the problem. The ground between the bulb socket and the bulb base is the most common reason for the problem you're having, which happens VERY often. If the mounting surface for the tail light assembly is rusty, or somebody has painted everything before it was assembled, run a ground wire from the socket assembly to the frame with clean, tight connections everywhere.
Jerry