The red wire always attaches to pin 1 of both the hard drive and
the controller or motherboard.
The red line is usually closer to the power connector. However,
older hard drives did not follow this convention. There might not
even be a specification for this. To be sure, look closely at the
hard drive for a distinguishing mark on one end of the connector,
such as a "1" or triangle indicating which end the red line should
be.