Final answer:
Bipedal dinosaurs had long tails to counterbalance the weight of their long necks, aiding in stability and movement. This evolutionary adaptation followed natural selection principles for survival advantages.
Step-by-step explanation:
The primary reason bipedal dinosaurs had long tails when they also had long necks was to counterbalance the weight of the long neck. This is similar to how modern birds and reptiles are balanced; the tail acts as a counterweight to the front part of the body, aiding in stability during locomotion. Much like the giraffes' long necks allowed them greater fitness through access to more food, as described in the LibreTexts example, the evolutionary adaptions of dinosaurs also followed principles of natural selection for survival advantages.
It is important to note that long tails for grasping objects or as a random evolutionary trait (without function) are not supported by evidence in the case of bipedal dinosaurs that had long tails to balance their long necks, and numerous species of bipedal dinosaurs, not just Archaeopteryx, had this characteristic long tail.