One of the things writers are urged to do, over and over, is to create characters who grow and change over the course of their adventures.
Obviously, growth and change are not an absolute requirement; there are plenty of long-running series in which the characters are exactly the same at the end of the book or episode as they were at the beginning. Still, character growth can be important even in the least character-centered, most action-adventure type of story.
So what makes a character change and grow?
The same things that make real people change and grow: facing a major outside challenge (physical, mental, or emotional); developing a close relationship with someone very different from themselves (as friend, sibling, parental figure, or lover); or facing their own inner demons and prejudices. It is not at all coincidental that these are the same sorts of things that make for gripping plots.
The basic action-adventure plot, for instance, is an example of the first sort of thing: the character faces a series of outside challenges, usually physical ones. He has to climb the glass mountain, slay the dragon, blow up the Death Star, win the championship game. Often, the physical challenges have an intellectual or emotional component (“I am your father, Luke”), but action-adventure means primarily physical action. Murder mysteries are another example of the “major outside challenge,” though in this case the challenge is as often mental (who did it?) as physical.
Romances obviously fit the second example: change due to a relationship (in this case, a romantic one). And a lot of mainstream and literary fiction seems to slant toward the third kind, a character being forced by circumstances to face his or her inner demons (though they can and do include the other sorts of changes as well).
Science fiction and fantasy don’t have a primary bent toward one or the other of the ways characters change. There are genres that do, of course; for instance, the sword-and-sorcery subgenre of fantasy and the space opera subgenre of science fiction are both varieties of action-adventure, and therefore have a strong tendency toward external, physical challenges that the main character must rise to meet. But even then, it can be hard to be sure that what the character is facing is really an external challenge. SF and fantasy both have a long history of stories where the main character’s inner demons are externalized in some concrete way, so that the external challenge is also a challenge on the internal level.
Note also that “facing a challenge” does not mean winning over that challenge. A character may learn more from failure than from success, though if it’s the final challenge that the main character fails, it can be hard to sell the reader on the idea that even so, that character came out of the story better off than when he/she went in. Often, that kind of lesson-learned-from-failure is reserved for secondary characters whose failure to achieve their goal can set off the main character’s triumph (it’s especially good for sympathetic secondary villains that the reader really wants to see reform…or at least, reform enough to survive when the good guys win).
What the change in the character is, depends on both the character and the challenge. Joe Hero may look like he needs to become more open-minded about other people, but if his big challenge in the story is killing the dragon without any help, he’s not likely to have a lot of opportunity to learn that particular lesson. I personally don’t set out to find ways for my characters to grow and change; if I try, either they go all stubborn on me and refuse to learn anything at all, or else the story gets so preachy that I can hardly stand it myself (much less any hypothetical readers).
What works for me is to let the characters wander around the story dealing with whatever curve balls I’ve thrown them until a pattern starts to emerge. Once that happens, I can either try to pull it all together in the Grand Finale, or (more likely) go back during the rewrite and tweak a dozen or so scenes to make everything clearer and more pointed. Sometimes I don’t see the pattern myself at all until an editor or first-reader points it out to me (that’s one reason why Across the Great Barrier added 10,000 words during the editorial revisions). Other writers know consciously what they’re aiming for right from the start; still others have a gut feel so strong that once the story is all written, it looks as if everything was carefully planned and positioned beforehand, even though it wasn’t.
Characters can change for the better, or they can change for the worse, and they aren’t limited to one change per book (though too many major epiphanies can be hard to justify). Changing for the better involves increasing positive characteristics (confidence, unselfishness, etc.) or decreasing negative ones (prejudice, temper); changing for the worse is, obviously, the opposite. You can play this off against your ending in whatever way you like: having the hero change for the better can make a catastrophic ending seem less of a downer, while having him/her change for the worse can mitigate the triumphalism of a great success; or you can have the catastrophe-plus-negative-change to get a real tragedy, and the success-plus-positive-change to make a really glowing happy ending. It all depends on what you want to do with your story.