I'm sure if you searched instructibles you will find plenty of how to repair headphone guides.
I saw one that looked pretty good where the author made a heat shrink headphone plug to salvage the existing parts.
I wanted to try to salvage more, and hopefully not make my cable look as chopped together.
Most likely the easiest approach would be to go to Radioshack to purchase a 2 pack of stereo connectors and just solder it together. I found them a bit too large and ugly for my liking.
You will need
Heat shrink tubing of a few sizes
and little things like helping hands (shown in #6) and flux are useful to have as well.
Step 1: Locate the faulty area
This is an obvious step but might not always be the easiest to do.
I usually try to hold different parts of the wire near the ends to try to isolate the area to flex, twist, or bend however necessary to make the sound go on and off while connected to a mp3 player or something.
It was obvious for mine because the sound would cut out whenever I moved the wire near the connector.