In the Pokémon anime, many Pokémon go through up to 3 stages of evolution. Why do they have to evolve? I mean, it does make it a bit more interesting, but Pokémon would still be interesting if they did not evolve and just stayed the same their whole life.
to quote the wiki
Evolution in Pokémon is closer to the real-life phenomenon of metamorphosis rather than actual evolution, as real-life evolution happens to populations over a long period of time, not to individuals. In the Pokémon Adventures manga, it is mentioned that Pokémon Evolution is an entirely separate phenomenon from the normal process of evolution, and is a mysterious ability exclusive to Pokémon that is still not fully understood. In Pokémon Super Mystery Dungeon, it is described in the health class at the school in Serene Village as when a Pokémon's body rapidly grows larger with many other changes bringing a Pokémon closer to being an adult, being described akin to puberty.
this is backed up by Professor Rowan
Rowan's research in Generation IV regards whether Evolution is a form of maturity in Pokémon, and looking at the implications of the process on Legendary Pokémon, which at that time did not evolve.
we see this clearly with Caterpie and Weedle who as they mature follow a similar pattern to what we see with Caterpillars and the like where we see it's Larva (Caterpie/Weedle), Cocoon (Metapod/Kakuna) and Adult (Butterfree/Beedrill) and since we know Pokemon come from eggs in Bye Bye Butterfree we can assume when Ash's Butterfree leaves with it's mate at some point eggs will be laid starting the whole process again.
ofcause this all comes down to Satoshi Tajiri idea when he though of the game
In the early 1990s, when Tajiri first saw two children playing together with Game Boys using the Game Link Cable, he imagined insects crawling along the cable between the two systems. As he thought about the capabilities of the Game Link Cable, his idea for Pokémon grew, as he wanted to give modern children the chance to hunt for creatures as he did as a child.
This insect idea is also shown with Caterpie/Weedle who in the Pokedex, are the first wild Pokemon as numbers 1-9 are the Starter Pokemon, 10 and 13 are Caterpie and Weedle with also Caterpie being the first Pokemon Ash caught in the series
Most Pokemon go through 3 stages. why do they have to evolve?
It's well known that the creator of Pokemon, Satoshi Tajiri, collected insects as a child, and, that by creating Pokemon, future kids would be able to collect and trade with friends their own kind of "insects".
That being said, in the real world, many (if not most) insects undergo multiple "evolutionary periods" (really called Metamorphosis) before reaching full maturity.
A great example of an insect with three [evolutionary/metamorphic] stages is the butterfly/moth. After being hatched from an egg, the caterpillar (larval stage) with eventually go into its cocoon (pupa), and then emerge as either a butterfly/moth (adult). Once the organism reaches its final form, its abilities are fully functional, and it's at its strongest (generally speaking).
Likewise, in the world of Pokemon, with each evolution that a Pokemon undergoes it grows stronger and acquires new abilities. The butterfly inspired Pokemon is Butterfree, with it also having three physical forms, each of them just like the butterfly's.
For an overwhelming number of Pokemon, the insect/animal that it was inspired by IRL can be derived from the name of the Pokemon.
So, in general, Pokemon undergo evolution because the original concept and design of Pokemon was heavily inspired by insects in the real world and how they develop and mature.
...but Pokemon would still be interesting if they did not evolve and just stayed the same their whole life.
Most Pokemon have evolutionary stages (around 80%), however, there are some Pokemon that don't evolve at all. I think this is fairly consistent with real life insects/small creatures.
Going just off the the anime (since this is Movies & TV Stack Exchange)...
To become more powerful and accomplish its goals
In Episode 46 "Attack of the Prehistoric Pokémon", Ash's Charmeleon got into a fight with an Aerodactyl and was losing badly. Apparently motivated by pride, Charmelon jumped up and grabbed Aerodactyl's tail, then evolved into Charizard, gaining wings that allowed it to fly on its own and battle Aerodactyl in the air.
Other times, Pokémon have evolved to help out its trainers. In Episode 31 "Dig Those Diglett!", Jessie's Ekans and James's Koffing are sad that they are too weak to win battles for their trainers, so they evolve into Arbok and Weezing respectively.
Presumably, most Pokémon’s goals are to become better in battling, which is why they tend to evolve.
As a result of peer pressure
In Episode 51 "Bulbasaur's Mysterious Garden", Ash finds a group of Bulbasaur who have a festival to evolve into Ivysaur. Ash's Bulbasaur is pressured to evolve, but doesn't want to, and it isn't until Ash gives a heroic speech telling them to let him stay who he is that they stop pressuring him.
Ash's Bulbasaur resisting evolution
As part of a symbiotic relationship that benefits multiple Pokémon
In Episode 66 "The Evolution Solution" Professor Westwood V wonders why a Shelder clamps down on a Slowpoke's tail and that this results in a Slowbro evolution. After witnessing the evolution and seeing Slowbro use Megapunch, he determines that it's a symbiotic relationship that benefits both. Shelder can move on land while Slowbrow can stand upright and use Megapunch.
As for why 'evolution' would be valuable from a story-telling perspective, it has multiple roles:
It is a milestone for the main character to have one of his pokemon evolve and makes character development of the sometimes rather flat characters of the creatures easier.
Later on in the series, it is an important metaphor for the conflict present in Ash's partner Pikachu. You see, the little critter has to make the hard choice between massive power (by Evolution, only possible when voluntarily using the Thunderstone) to be more useful to it's trainer or keeping to himself, as Pikachu knows that after the 'evolution', Pikachu's personality will change (albeit minor). So, is it worth it to betray oneself for great power?
Fitting for a childrens show, this apparent dillema is resolved by having Pikachu become stronger by more mundane things as training really hard and the power of friendship and such. But it is the presence of the initial dillema that makes the story more powerful.
It allows for the 'David vs Goliath' scenario, by having a pokemon face his evolved form, which is seemingly vastly superior, but this is eventually shown to be merely superficial.
So, having a very clear measure of power, it lends itself as a nice narrative element for many interesting stories.