Why is it so hard to stick to goals to live better? We promise ourselves we're going to eat better, for example, but then at the end of the night we find ourselves snacking on whatever's around while staring at a TV or device screen.

New research finds that part of the reason it's hard to stick to resolutions is that our brains get easily distracted by past rewards -- even when we've realized that reward no longer exists or was never real in the first place.

But the good news is that there is a way to hijack our brains and snap out of that loop of habit and reward. It just involves a little trickery.

Johns Hopkins University neuroscientists recently completed a study showing that the human brain is wired to gravitate toward previously pleasing things, even if they are no longer pleasing. And the culprit in all of this? Dopamine.

For the study published in Current Biology, researchers asked participants to spend several hours looking for red and green objects on a screen filled with different coloured objects. They were paid $1.50 for every red object they found and 25 cents for every green one -- not a bad reward for easy work.

The next day, the researchers had the participants do the task again while undergoing brain scans, but this time, colour no longer mattered; they just had to look for certain shapes. And this time, there was no reward for good work.

Just to confuse the participants, the researchers continued to throw in red objects into the mix of shapes. As expected, the participants automatically were drawn to them. What's more, the area of their brains involved in attention filled with dopamine -- a brain chemical released when we expect or receive a reward. When they saw red things, they had been conditioned to anticipate a reward, even though they knew there was no reward. The participants did find the shapes, but because they were distracted by those red objects, they were slow at completing their tasks.

The researchers say the results show that once a certain behaviour becomes a habit, we often don't have as much control over our brain's responses to cues as we might think.

The study is just one of many in recent years that have shown just how important triggers and rewards are to forming habits. Our brains are wired to prefer habits, studies have found, because they are essentially shortcuts to rewards. Why waste brain energy rationalizing each decision when our brains find it easier to just automatically do what's worked fine in the past.

Breaking the 'habit loop'

But research is showing that the best way to "unlearn" a bad behaviour that no longer brings us a reward is to replace it with a new one that will.

Pulitzer Prize-winning author Charles Duhigg dove deep into this topic in his bestselling book "The Power of Habit." He found that the key to breaking "habit loops" is threefold: identify the cues that set you off onto that bad habit; figure out what reward you think you're getting from that bad behaviour; and then find a way to satisfy that reward craving with something else.

So, to go back to that bad habit of snacking in front of the TV every night, ask yourself what reward you get from snacking? Is it to satisfy genuine hunger? In that case, a piece of fruit should do the trick nicely. Is it relief from boredom? Maybe a walk around the block, an exciting new book, or going out for a class would make for a better evening routine. Is it comfort you seek in snacking? Maybe a phone call to a friend, warm bath, or going to bed earlier would fit the bill.

Once you've figured out the empty reward that drives your behaviour, it becomes easier to figure out how to replace the bad behaviour with a more satisfying reward, Duhigg writes.

He suggests figuring out your worst times for bad habits -- the evening hours between 7 and 9 p.m., for example; using electronic reminders alarms to cue yourself to switch to your new habit, and taking lots of notes about how you're feeling along the way to figure out what works.

(Duhigg offers more thoughts on that in this video)

By consciously making an effort to create a new routine to replace the bad "habit loop" that offers no real reward, you'll soon shift into a new habit that makes you happier and fills your brain with dopamine for all the right reasons.