Many therapies are based on the premise that our automatic thoughts, our self-referential stories have an enormous impact on our experiences of life. This might seem obvious, but I just wanted to put it out there as a preface to talking about mantras.
We have tens of thousands of thoughts a day. They flit through our minds so quickly that we hardly notice. Most of these thoughts won't ever register as memories; there's no emotion or importance attached to them so they just come and go.
We speak aloud approximately one thousand sentences per day (it's true that men speak less than women). These thoughts are more important: we've chosen them, arranged them into sentences, and their very importance means that there is some degree of attachment or emotion tied to them, also they are now connected to the physical actions and sensations of speaking and hearing. As you involve more senses in the creation of a memory, you're activating more areas of your brain, and building more neural connections to that memory. The interactions of the multiple regions in our brains necessary to speak mean that these thoughts stand a better chance of becoming memories; the more connections the easier the memory retrieval. That said, most of what we say is pretty fluffy; "hi" and "what's for dinner?" are unlikely to stick around long.
The thoughts that stick around as lasting memories are the ones that either repeat frequently, or are deeply important and therefore emotional. There are evolutionary reasons for this, which are connected to community stability, safety, and survival. If something is dangerous and scary, or invites the displeasure of people upon whom you are dependent, you don't want to forget and accidentally do it again. So out of necessity, we've evolved to remember these things.
This has both negative and positive implications:
Negative thoughts carry about three times the psychic weight as positive ones. This is important to remember in child-rearing, or teaching, because children are especially vulnerable as they are forming their worldview, and sense of self. A careless criticism takes a lot of repair to fix, and can have long-lasting consequences.
The positive side of this is that we can choose to actively repeat certain thoughts, or better yet say them aloud. We can make thoughts take up more mental real estate by repeating them, feeling them, investing in them, and we can consciously choose what we want those thoughts to be.
An interesting exercise is to take a moment to think about what you want to believe. Keeping in mind that you can't trick your subconscious, you want your mantra to be rooted in reality. In this exercise you want to come up with a positively phrased sentence that acknowledges the truth of the situation, but also voices the preferred thought. Once you've created the right mantra for your situation, you then want to ritualize it to give it gravitas, and so that you'll remember to use it. Something like "I'm nervous about riding in cars because of the car accident, but I want to be comfortable riding in cars again," said aloud every time you get into a car. It's worth a shot at any rate; I've seen it be very useful in conjunction with therapy when working with PTSD.