When it comes to the condition of your cable, anything that happens after the pinch bolt on the derailleur will not affect the shifting. So, if your cable end gets torn off, and if the piece it leaves behind is so frayed that it looks like the gnarled bristles of a tiny metal witch's broom, your bike will still work fine. But what if you need to detach your derailleur? What if you don't want a wire metal rat's nest on your fancy bike? What if you don't like poking tiny holes in your ankle every pedal stroke? You need a pair of pliers and some dexterity, and your problems are solved.
If this happens on a brand new cable, you can probably wind it back with your fingers. But if it's particularly mangled, you'll need some more force to tame the strands back into position. Squeeze the cable gently with the pliers, right where the cable comes out of the derailleur pinch bolt. Keeping as constant tension as possible on the pliers, spin them clockwise while sliding out to the tip of the cable. Even if the cable is damaged, the pliers will keep the strands from going anywhere but their natural, clockwise spiral. Replace the cable end and get a firm crimp on it so it stays put this time.