Why do some bad traits evolve, and good ones don't?
During the process of selection, individuals having disadvantageous traits are weeded out. If the selection pressure isn't strong enough then mildly disadvantageous traits will continue to persist in the population. 

So the reasons for why a trait is not evolved even though it may be advantageous to the organism, are:


There is no strong pressure against the individuals not having that trait. In other words lack of the trait is not strongly disadvantageous.
The trait might have a tradeoff which essentially makes no change to the overall fitness. 
Not enough time has elapsed for an advantageous mutation to get fixed. This doesn't mean that the mutation had not happened yet. It means that the situation that rendered the mutation advantageous had arisen quite recently. Consider the example of a mutation that confers resistance against a disease. The mutation wouldn't be advantageous if there was no disease. When a population encounters the disease for the first time, then the mutation would gain advantage but it will take some time to establish itself in the population.
The rate for that specific mutation is low and therefore it has not yet happened. Mutation rates are not uniform across the genome and certain regions acquire mutations faster than the others. Irrespective of that, if the overall mutation rate is low then it would take a lot of time for a mutation to arise and until then its effects cannot be seen.
The specific trait is too genetically distant: it cannot be the result of a mutation in a single generation. It might, conceivably, develop after successive generations, each mutating farther, but if the intervening mutations are at too much of a disadvantage, they will not survive to reproduce and allow a new generation to mutate further away from the original population.
The disadvantage from not having the trait normally arises only after the reproductive stage of the individual's lifecycle is mostly over.  This is a special case of "no strong pressure", because evolution selects genes, not the organism. In other words the beneficial mutation does not alter the reproductive fitness.
Koinophillia resulted in the trait being unattractive to females. Since most mutations are detrimental females don't want to mate with anyone with an obvious mutation, since there is a high chance it will be harmful to their child.  Thus females instinctually find any obvious physical difference unattractive, even if it would have been beneficial.  This tends to limit the rate or ability for physical differences to appear in a large &amp; stable mating community.


Evolution is not a directed process and it does not actively try to look for an optimum. The fitness of an individual does not have any meaning in the absence of the selection pressure.


If you have a relevant addition then please feel free to edit this answer.