At the heart of every habit exists a simple neurological loop which was discovered by research scientists at MIT. A cue triggers a routine and a resulting reward reinforces the loop. Repeated enough times, this loop installs itself as a habit in our primal brain.
Take for example my annoying (and rather pointless) habit of checking my email every five minutes. The cue is having my smartphone within arms reach, the routine is hitting the email refresh button and the reward is the anticipation of an exciting new message. I have performed this loop thousands of times and it has unfortunately become a habit which wastes a lot of time and disrupts my concentration.
Of course habits, don't have to be negative. The same loop can be applied to positive habits too such as working out, eating healthy food, stretching, meditating etc. Stacking these positive habits together and continuously hitting small wins is very important when it comes to successfully losing fat, building strength, feeling energetic and being healthy.
For more information on this topic I thoroughly recommend reading The Power Of Habit by Charles Duhigg which dives deeper into the fascinating world of habits and their influence on our lives.