If it is a cable,
1) It needs to be attached.
2) The cable could be broken inside of the housing and you would need to get a replacement speedometer cable.
3) The previous installer may had jammed the cable sideways when it was last installed, and it could be grinding into the housing instead of spinning your speedometer.
If it is an electric drive,
1) Please make sure all connections are good.
2) There are three wires. You can use a Volt meter and an Ohms meter to test for: Red Wire: 12v with key in the ON position, Black wire: make sure the ground is grounded by checking that it has no resistance with any other metallic object nearby. For now don't worry about the white wire.
3) We have seen water or other elements damaging the electric sensor from the inside out. You might have a bad sensor. They are rather pricey to replace, at least $100 used.