This often happens when the speedo cable core binds a bit, then releases, and does that over and over. Pull the core out of the cable sheath... it pulls out from the top IF I recall right. Inspect it for frays, kinks, etc. If OK, then find some light moly based grease; moly cam lube works really well. Very often a good clean and lube of the core is all that is needed.
If the core is frayed/broke/kinked, then you can find kits around to make a new one. If the sheath is in good shape, a new core will do it. Just make sure the new core length is the exact same as the old one.
One other possiblity is that the square 'socket's in the speedo itself or the speedo gear on the trannie has become rounded out. So remove the cable from both ends and inspect the socket in the speedo and gear (where the core inserts at each end) to be sure both ends are still square and have not turned out to a round shape.
If all good in the cable, then proceed to the speedo itself....BTW the speedo is all mechanical, not electrical like in new cars, so no sensor is involved.