How I Met Your Mother's twist ending left audiences frustrated and proved an old TV rule to be a myth. The series spent nine seasons leading up to the moment that Ted Mosby would meet his wife but flipped the bill by killing her character off almost immediately. Since some of the critical scenes of How I Met Your Mother's finale had been filmed nearly a decade previous, it was clear that this had been planned from the start. However, that doesn't mean it was the right move, and the divisive ending demonstrated that the long game isn't always the best.
https://screenrant.com/how-i-met-your-mother-ending-tv-plan-disprove/