Most likely one of these:
1. the data cable is loose - check both ends.
2. the data cable is connected the wrong way round. The red stripe normally goes to pin 1 on the drive and motherboard and the twist in the cabling goes to the drive.
3. the drive is duff and should be replaced.