There's always something you can do or a step you can take. Define it and focus on proceeding one step ahead of it. If you've tried too many times before and failed, now is probably the time to realistically estimate what you can and can't do.
Once you remember what to do, don't give your mind the opportunity to push you away. The more you procrastinate, the more difficult it will be for you to maintain the habit.
If it's a tough habit, you will find yourself thinking about your inability to maintain such effort in the future. To build any habit, train yourself to always think in the present. You have no idea what will happen tomorrow and you're neglecting the fact that you'll get better by time.
The biggest mistake you will make when screwing things up (and sometimes you will) is to screw up even more, give up and make your situation even worse. Before you start, think first of all the setbacks you may encounter and prepare yourself mentally to keep moving when things don't go your way.
Give your habit meaning and link it to a bigger goal. Some new habits require a massive amount of energy. Keeping yourself highly motivated is the best way to ensure your success.
Make it clear to people that you're after a bigger goal (the goal for which you need to build your habit). This will force you to take the required action and maintain your new habit.
For every new habit there must be an old habit that needs to be removed. Someone who wants to lose weight must first identify his need to get rid of the habit of emotional eating before starting his/her diet. Most of the time, being aware of these obstacles is enough to get rid of them.
Perfectionism can negatively affect the creation of new habits when a person deals with every set back or relapse as if it's the end of the world. Preparing the mind to recover fast from setbacks will positively affect the continuity of doing that new desired action.
Example: Those who just get dressed and walk to the gym (or work out with friends) are more likely to complete a workout than those who work out from home. Attaching the habit to others increase one's level of commitment and makes him/her rely less on willpower to take action.
Unless the source is very strong, getting used to a single source of motivation like a book or song or a single incident might create boredom and keep the person less motivated by time.
The faster a person gets results, the more the mind believes that this action is rewarding and the stronger the attachment to that action will be. Short term goals that are easy to be reached and that generate fast satisfaction can help build habits quickly.