No peacocks don't grow tail feathers on purpose, it's all natural selection, through the mating process. You have to live to mate, but just long enough to mate. And the male, generally, picks who she mates with. So males want to be attractive.
Wanting to be attractive implies that they have to put on certain feathers to do so, but as pointed out, that doesn't take place. Rather, certain traits appear through random mutation, and it's the environment that determines whether those traits are advantageous or not. Worse, changes in the environment may make traits that are advantageous the opposite.