Selective breeding is the cause of that. Particularly, peacocks with large tails are forced to mate together to produce offspring with large tails. from the offrspring the ones with the largest tail are chose again and they mate. This process goes on until we have a fair amount of the animal with the desirable characteristics
1) Genetic variation is present in an ancestral population due to mutations.
2) There is a selection pressure in the population incase of competition for mating.
3) The better adapted members are more likely to survive and reproduce survival of the fittest because of their flashy tails.
4) These survivors will pass on their allele for this improved adaptation to their offsprings who will shows this beneficial phenotype.
5) The frequency of this allele will increase over the next few generations.