The random changes a mutation causes to an organisms genetic code causes either
1. A different protein to be produced or
2. none at all
Mutations can either have a positive, negative or neutral (the vast majority) effect on the organism. (many times whether they are harmful or helpful depends on the environment.)
When a mutation makes an organism better able to survive that organism is more likely to survive and pass the mutated gene onto the next generation.