It depends on the type of computer. If it's a desktop, you just look at the old one to see if its interface is SATA or IDE (describe the cables attached to it and we will tell you), buy a new one for fifteen bucks, and swap. While you are looking at the cables, reseat them (remove and plug back in) and see if that solves your problem.
If it's a notebook, you will have to buy a compatible device from the manufacturer or an after-market provider, and it will be expensive.
So: what kind of machine do you have?