They take turns! Easily explainable in mechanical terms —lead bird is tired, slows down, another bird overtakes, and the v formation algorithm kicks in again.
But it could be more than that. Maybe the lead bird vocalizes or signals that they want to swap out, and some type of social status determines the order, with disputes resolved by wing flap aggression. Or maybe not.
If, as Jane’s Addiction and many sf authors have imagined, we’re being kept as pets by aliens, much of our behavior would look rules-based, unthinking and reactive.