Dopamine was discovered as a neurotransmitter by Arvid Carlson. It is vital for stamping-In stimulus reward and response-reward association. Meaning your brain identifies the stimulus that gets rewarded and associates these responses to certain rewards, to the stimulus that triggered dopamine.

Every behaviour that is highly habit-forming is associated with higher levels of dopamine. Dopamine is not only released when you experience pleasure but also when you anticipate it. Whenever dopamine rise so does your motivation.

The reward system that is activated in the brain when you receive a reward, is the same system that is activated when you anticipate a reward. What this means is that rewarding habits is a crucial element to the formation of new habits.

Most of us devise various methods to instill new habits but fail to put in place reward systems. Thinking of the reward system as part of the habit-forming process makes it easier for your brain to help you in keeping and maintaining desired habits.

This is in the second law in Atomic habits which is to Make it attractive. The more attractive an opportunity is the more likely it is to become habit-forming. If you want to increase the odds that a behaviour will occur, then you need to make it attractive. Habits are a dopamine-driven feedback loop.