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.
Step 2: Carefully Slice It Open
I must emphasize carefully, for it is small and knives tend to slip. My headphone plug was rubber and was fairly easy to cut.
I cut it along the outside seam of the molding. I attempted to avoid cutting the strain relief (the flexible area where most wires break) but the wire appeared to be fused to it and I had to cut that part open as well.
The end was encased in some sort of plastic, I assume similar to hot glue. We will deal with that later.
I chopped off the end about an inch from the source of the problem.
Step 3: The Source of the Problem...
I sure hope I can figure out how people make those little highlights.
Just to show common breakages...
One of them has damage to its insulation, and the wires were frayed internally.
The other... well was just broken completely so when I pulled the wire, the insulation came off and left the string behind. (Most headphone cables are braided string and wire to make it more durable)
Step 4: Heatshrink
Remember to add the heat shrink to the cable before attaching the wires!
I found 3 sizes that fit...
The white one made it about half way up the strain relief
The red one made it all the way up the strain relief
The black one, which should have been a bit longer, fit over the connector itself.
Step 5: Remove the Plastic Around the Plug
Do this however you find safe.
I cut away at it with a knife until I got tired of it and jabbed at it with my soldering iron. Once I melted away some parts, its just a matter of gentle prying to get all the way down to the metal.
Oh and make sure you take mental note of where the wires go. In my case, the red wire was connected to the top.
Step 6: Tin the Wires
Clean plug, strip, and tin the wires.
A lot of these wires wont hold solder very well so a bit of flux and some patience for whatever enamel or impurities to melt away will result in a nicely tinned wires.
Step 7: Solder
Work fast, the plastic on these dumb connectors tend to melt under too much heat. Part of the reason tinning the wires can make a big difference! Just hold over the blob, and heat with iron.
Step 8: Testing...
Insert it back into the case and test it out.
I jumped the gun and used heat shrink it a bit too soon and realized I forgot hot glue.
Pry it apart and inject some hot glue, push it back together and wait for it to cool. When its cool, pry it apart again and squirt in some more hot glue. We don't want it to move or fall apart easily!
Step 9: Add Some More Heat Shrink and Hope for Nice Results.
For anyone who isn't familiar with using heat shrink, just remember fast and even heat.
The amount they will shrink varies, and I believe the tag typically states the amount it can shrink... just try to keep things snug and you will be fine.
I used a lighter and waved it under the areas with heat shrink tubing as I rotated it.
Hope this will help guide you in repairing some of those broken cables. I just wanted an excuse to try to make an instructible! :P