Handicap principle
So why did it evolutionarily survive? According to the principle, one day, a mutant peahen that likes peacocks with longer tail, looked for a male with this characteristic. The mature male she found was strong enough to survive even though it had a long tail and therefore it is probably stronger than the average peacock. Therefore, its predecessor males are going to be stronger and also to have a long tail while the newborn females are going to like long tails, passing the ideals of the principle to the next generations.