Turn off the PC, disconnect the data cable only (leave the power cable) and then turn it back on. If there is no ticking now, the data cable (SATA) is bad or potentially was just loose.
It could also be just drive noise during data access (nothing to be alarmed about). Or it could be heat-retrains because the drive is out of alignment (drive is probably dying if this is the case).
The drive is not getting enough power. Check the power connector. Try a different one coming from the PSU.
It could be the drive heads parking/unparking in or out of sleep or hibernation modes. Nothing to worry about if this is the case.