Scenario 1: The message is a key element
Let’s not forget about fairytales, fables and stories for children. There’s a lesson to teach, a "light bulb moment" to induce. If you ask at the end of the book or tale "What’s the moral of the story?" the child or reader needs to be able to answer that clearly. Often the message will be that the good triumph over the bad, that lies will get you in trouble, and that knowledge and intelligence are of great help.
To some extent, this holds true for YA (Young Adult) fiction, too. Young adults are going through a phase in life where they want to find themselves, rebuild their existence, lay claim on the future and find a goal to pursue. No wonder there is so much idealism, so much conflict and so much loneliness found in YA books. The message is an essential part of the novel, it’s the leitmotif, the theme spanning over a book or whole series. Mostly, you need to convey a sense of victory, of personal strength and / or strength in numbers.
Scenario 2: The message is the hidden bonus
Apart from that, a discerning reader will always take advice or insight away from a good book. Contrary to what some say, I firmly believe that it is important to include a deliberate message in what you write. Especially in the romance genre where you deal with people’s external and internal development, with love and with the interaction between people, it’s essential to know what you send out there. If you consciously think about that part of the story, you don’t run the risk of having an undercurrent to the book that conveys something you don’t even realize or would never support.
That doesn’t mean that you should be a preacher! The art lies in how to convey a message in your story without overdoing it or ruining the reading pleasure. You don’t want to scream things in the reader’s face. Long sermons where you wax lyrical about God and the world aren’t ideal either. Rather, try and include the message in a subtle way: by weaving it into dialogue, by asking rhetorical questions that the readers will answer for themselves, or by hiding the motif in the plot or development arc of your character or including it in the (happy or unhappy) end. I’ve found a good quote online – I wish I knew by whom – that says:
The trick is to make the theme fit the story, not the story fit the theme.