Joining two wires together in any fashion is called splicing. However, there are many different ways to splice a wire. Crimping, using wire nuts, soldering and simple contact will all establish an electrical connection. The difference lies in how well the new joint will resist forces and torques. Soldering offers the most reliable way to splice headphone wire because headphones suffer little vibration and much pulling. Furthermore, soldering does not add much bulk to the wire. That helps the headphones stay portable and convenient.
Strip the outer insulation of each wire half an inch at each end. Then expose the bare copper by stripping the inner insulation. Plug in the soldering iron and let it heat up.
Slip the heat shrink onto one of the wires, keeping it away from the splice so the soldering iron doesn't shrink prematurely. Often, the wire is too thick to place heat shrink after making the splice.
Identify which wires should be spliced together. There are three to four wires in a headphone cable, a left signal, a right signal and one or two grounds. Often you can simply match wire colours, other times you must use a multimeter to identify each wire.
Touch the bare copper of each wire you wish to splice together at a 90-degree angle, then twist the copper strands around each other to ensure electrical contact. This is called a western union splice.
Touch the tip of the soldering iron with some solder, letting it melt. This allows solder to flow more easily.
Touch the tip of the soldering iron under the splice and place solder on top the splice. Melt just enough solder to form a thin coating over the splice. Cover each splice with electrical tape to prevent short circuits. Repeat for each wire.
Slip the heat shrink tubing over your splices. Heat it with the heat gun. The tubing will shrink and protect your splices.
Some headphones have two ground wires, one for each channel. A good soldering joint will be shiny.
Always work in a well-ventilated place when soldering.