Cognitive Sciences Stack Exchange is a question and answer site for practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry. It's 100% free, no registration required.

There are too many possible answers, and good answers could easily get too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. I like the general question though, so I won't mind if others find it acceptable, and I encourage people to attempt answers regardless of whether this gets edited, unless others vote to put it on hold too. In the meantime, consider consulting Wikipedia and other questions tagged habituation for some hopefully useful hints.
–
Nick StaunerFeb 7 '14 at 20:40

@NickStauner I had no idea it would be too-broad. Is it specific now?
–
Bleeding FingersFeb 7 '14 at 21:18

IMHO, you haven't really narrowed it down, but if you're only interested in the general question, maybe a relatively brief, general answer will suffice. I'm working on excerpting it from Wikipedia myself, hypocritically enough! Finding it surprisingly useful to do so too, being a motivation researcher and theorist myself...
–
Nick StaunerFeb 7 '14 at 21:27

only if necessary, carefully consider the situation at hand and think
about the best reaction

If you do the same thing over and over again, then obviously it is either the best possible or a sufficient reaction to the situation in which it occurs. To free some of the limited and valuable cognitive capacity, that behavior becomes automatic. Only if the situation is different and the habitual behavior does not properly fit, will you have to think.

Here are some excerpts from Wikipedia you might find helpful for the (somewhat too-) general question:

A habit...tends to occur subconsciously.[(Butler & Hope, 1995)]...[Andrews (1903)]...defined [habits as]: "...acquired through previous repetition of a mental experience." Habitual behavior often goes unnoticed in persons exhibiting it, because a person does not need to engage in self-analysis when undertaking routine tasks. Habits are sometimes compulsory...Old habits are hard to break and new habits are hard to form because the behavioural patterns we repeat are imprinted in our neural pathways...but it is possible to form new habits through repetition [(Rosenthal / Psychology Today)].

As behaviors are repeated in a consistent context, there is an incremental increase in the link between the context and the action. This increases the automaticity of the behavior in that context [(Wood & Neal, 2007)]...

Habit formation can be slow. Lally[, Van Jaarsveld, Potts, and Wardle] (2010) found the average time for participants to reach the asymptote of automaticity was 66 days with a range of 18–254 days...

Sorry this isn't a better answer. I spent a couple hours past this version, including some effort to flesh out the references section with links to freely available articles and to improve the Wikipedia page itself, but...my browser crashed, and I lost all that work. I'm a little too bummed and short on time to recreate my lost work. I mostly cut out the irrelevant parts and looked up full text links on Google Scholar, but you can do that for yourself, so I'll leave it to you. Feel free to edit if you can improve this.
–
Nick StaunerFeb 8 '14 at 1:03