Male peacocks - and many other bird species too - have spectacular 'tails' (or, more exactly, trains) or other extravagantly developed and brightly colored structures. A peacock could inseminate a female just as well without his remarkable tail, and in that sense it is a secondary, not a primary, sexual organ. The peacock's tail almost certainly reduces the male's survival: the tail reduces maneuverability, powers of flight, and makes the bird more conspicuous; its growth must also impose an energetic cost.
Why are these costly characters not eliminated by selection?
Darwin's solution was his theory of sexual selection. He defined the process by saying that it
"depends on the advantage which certain individuals have over other individuals of the same sex and species, in exclusive relation to reproduction."
A structure produced by sexual selection in males exists not because of the struggle for existence, but because it gives the males that possess it an advantage over other males in the competition for mates.
Darwin's idea is that the reduced survival of the peacocks with long, colorful tails is more than compensated by their increased 'advantage in reproduction'.
Why do females prefer males with long tails?