Really? You can't even think up anything that we have that is harmless in genetic code?
Sure. A couple that comes from the top of my head.
Gene for lactase. (environmental pressure, but not necessary in most parts of the world)
Eye color. (survival of the sexiest or survival of the non-cheater)
The complex genes for citric acid energy uptake of the E-Coli bacteria in the Lenski experiment. It was a multiple gene mutation, the first one harmless, if I understand it right.
I was thinking about other ones but they left my head before I could write them down.
It does.
(edit)
An short explanation. DNA is the code with which it is stored. DNA is the storage. There are some scientists experimenting using it to store data in DNA. Genes consist of nucleotides. A nucleotide is a sugar polymer. It's molecule. There are four basic and one variation of these, depending on where they occur. They're assigned letters based on their chemical names. They can be joined together in a chain, which is the RNA. But they can also attach to their counterparts in another RNA and hence make a DNA (double helix, RNA is single). The details would take me too long right now to go in to.
How does it know it will need it? It doesn't. First, it has to be a coding gene. Secondly, there has to be a selective pressure for or against a trait that the gene is part of. The whole system is very complex though because in most cases there are multiple genes involved, not just one. So it's rarely survive-or-die situations but rather more success or less success.
Why is it retained? Because it sticks around. It would require someone who looks at it and use intelligence to remove it. The fact that we have pseudo genes and malfunctioning genes is evidence that no-one is monitoring and modifying it on intelligence, but rather by chance.
For how long? Random. Some genes can stay for a very long time unchanged and others not. It's a roll of the dice.
If it dies? Genes are not really alive like an organism. They're chemical compounds. They change. They don't die. Perhaps you're thinking of the cells? They die because of multiple reasons, one being that the telomeres are being shortened in the mtDNA after each division. Our mtDNA (which is important for energy metabolism, and is in fact a separate, other DNA in our cells, we have two different DNA systems) can only divide some 20-25 times (I think), but they live for 7 years. Hence max lifespan just above 100-110. All our cells will eventually give up, not being able to divide healthy cells. However, there are scientists who might have solved this problem and in a few years, we might have things that will extend our lives with hundreds of years.
(end edit)
You have right now 98% of your DNA that's non-coding, i.e. does not produce polypeptides. They're dormant. That's billions of genes in each one of your cells right now. It's retained, but not with an intent (intelligence thinking that it's needed), but it's just retained out of benefits. One benefit is the help keeping the structure of the DNA, and other things, but they're practically quiet or dormant. A simple mutation can turn them on. For instance kids born with full body hair. They look like a little monkey, because we still have the gene for full body hair, but it's dormant (turned off). If our climate changes and gets really cold, there's a chance that children born with that turn-on mutation of the bodyhair will survive better than you or me. But in this climate, right now, there's no need. But on the other hand, we might never have one born again with it, and our future is doomed. It's a matter of chance. The interesting thing is that the mutation is so tiny and simple. Did you know that chicken carry a gene for teeth? Yeah, they have the gene still from their dinosaur past. Scientists have switch that gene on in experiments and have chicken born with teeth.
It does have a target: survival to successfully reproduce. That's the only target. To reproduce. Genes that prohibit reproduction and survival will die out and be gone from the gene pool, but genes that don't stop reproduction and doesn't hinder survival too much, they will hang around. This we know for a fact. This is what we have observed.
Yes, I'm telling you. Only 20-25,000 genes of the human genome are actually coding for a protein. The rest are turned off. They're not totally wasted because they help with keeping a structure to the DNA, like a scaffolding, but in there, you have traces of our ancestry. Unfortunately, I'm not sure how much research has gone into the non-coding genes yet to identify them. It took a long time just to decode the useful ones.
I always try to not use big words. I don't like big words.
My interest is rather to give a very brief, rudimentary overview of things that I know science is very certain about. One is evolution. We have more evidence for evolution and how it works than Big Bang itself. There are over a half million fossils for instance. And much more. It's in a way easier to test evolution than it is to test Big Bang, and cheaper, but some things in evolution is really difficult to test. Reading the millions and millions of nucleotides in the DNA isn't easy, but the technology is improving, and sequencers are expensive (but not really compared to a space rocket, LOL!).