The inner drive cable, the part the turns, is a small diameter but very long coiled spring. If it should catch on the outer sheath the drive end in the transmission will keep turning and the spring will just store the energy. When the spring frees itself the energy is released and the needle will jump to catch up. A speedometer the jitters or jumps regularly is like this. Naturally if the cable cannot free itself the spring will simply twist and break.
Use vice-grips to loosen the transmission end of the cable and pull straight out. Have lots of cloths ready or a container to catch the cable in and keep it clean. Once free pull the inner cable out and collect it. Have a care as it's slithery and oily and hard to handle. If the cable is dry, lube with a graphite powder or molybdenum grease. Inspect the outer cable for kinks or damage from catching on something. In this case it may be better to just replace it.
When installing the inner cable, twist it (both ways) with fingers and confirm the speedometer is engaged and jumps then engage the transmission end and tighten the nut. The end has a ferule and only goes in one way.