How does a second hard drive in a computer work?

Overall, a secondary hard drive works the same as a primary hard drive. In the case of PATA drives, the secondary hard drive operates as a "slave" drive. It disables its controller and lets the primary hard drive control it. This is determined by jumper settings on both drives and/or the cable position.

While SATA drives are modeled after PATA drives, SATA drives operate on independent channels, and thus every SATA drive is a "master" drive. Their order or addressing are all dependent upon which socket they are plugged into.