Themes are a difficult concept to pin down, but I think the definition is something close to "an area of the human psyche central throughout the story". Every story should have one, and preferably just one. A well-executed theme is something the story can be said to be "about". I'll give some examples to illustrate my theories about the concept.
Star Wars is a story about temptation and redemption. The Jedi are obsessed with the fear of themselves turning to the dark side, and it's shown to be justified as a Jedi turns to the dark side is almost every Star Wars story. The entire prequel triology is about how one great Jedi became one of the most heinous Sith before being turned back by his unreaonably idealist son. I suspect this is the one of the main reasons for the story's popularity: it has a strong theme that's close to the center of human nature (as well as to the most popular religion).
Another story with good theming is the first Mistborn trilogy, especially the first book. It has two major themes: hope and trust. Hope is the external, ostensible theme that would be preserved in a plot summary, and trust is the internal theme that's the center of Vin's arc. Most of the time having more than one major theme is bad for a story because they draw attention away from each other, but in Mistborn, due to the contrast in the roles they fill, these two themes don't clash.
Doki Doki Literature Club is a story about repentance and forgiveness. The plot culminates in finding out who murdered the other girls, and spends the little duration it has left making her seem forgivable, and for extra effect, it ends showing one of the characters you probably thought most innocent following the same path in the same situation. By the end, most players don't see Monika as a villain, because she isn't. This is a very well-executed theme. Hell, it played a significant role in turning me away from axiological retribution!
An example of a story without a strong theme is Mass Effect.
In the beginning of Mass Effect 1, it seems like it's about "humanity finding a place in a galaxy of more advanced and more experienced alien races". But that theme kind of gets dropped. Nobody ever mentions it again until the end of the game, where suddenly humans are the heroes for saving the Citadel from Sovereign and everyone looks up to us now. And in future Mass Effect games they just soft-retcon that ending and go back to the galaxy not trusting Shepard and the human councilor not having any power, and completely ignore the theme.
But in the encounter on Virmire where Saren reveals his motives and they're actually pretty interesting, it seems like the game might pick up the entirely new theme of axiological defiance as mentioned above: the Reapers are coming and we're hopelessly outmatched, but it's still wrong to give up and willingly submit to them! We have to try! That theme also isn't referenced again, until vaguely at the final scene, where it's distracting from the resolution to the original theme.
What I'd have done is take the theme of defiance referenced in the Saren conversation and make that the main theme of the story. It would be foreshadowed early in the game (perhaps with a situation that was sort of a microcosm of the issue), and then it would be even more satisfying when Saren revealed that.
Mass Effect Andromeda went a completely different direction. In the beginning they sell the theme of "exploring a new land and finding a home". Unlike the previous games, this theme is at least consistent. It's there all throughout the game and one of Ryder's final lines can be (asked what the Nexus should be told) "Tell them we're home". This is an improvement. I would've liked it a lot more, but that particular theme doesn't resonate with me at all.
So I hope that was insightful. Next time you're planning a story, ask yourself what the theme is, and hopefully decide on an answer before you get too far into the process.