Habit (according to the Merriam-Webster Online Dictionary):a. a behavior or pattern acquired by frequent repetition or physiologic exposure that shows itself in regularity or increased facility of performance; b: an acquired mode of behavior that has become nearly or completely involuntary habit> c: addiction habit>
Generalising, a habit is something that is done in a regular way.
Every animal has some kind of habit, but whether these are related to mating or to hunting a prey, the main goal is always survival. For an animal, a habit will be the thing that worked the best in ensuring its survival or the survival of its offsprings.
For human beings, an habit is usually more related to the psychological, often irrational, part of our mind / brain / ego sub- semi- consciousness.
I think we do consider a habit everything that it is done automatically. It can refer to very different things. I regard as an habit the road i take to go from home to the station in Zaandam: i am so used to it that i don't even have to think about it while I ride the bike: my sub-conscious is taking care of it.
Coffee, smoking, even sex sometimes are considered habit when it becomes "routine".
In science terms, a habit can be seen as a "dose": taking a dose of medicinals, bacause of the addictive power that many medical drugs have, is pretty much comparable as something seen as a "bad"habit like smoking.
In religion, habits are really important for faith's purposes. For many people nowdays, going to the Mess on Sunday has become a routine more than a meaningfull ceremony. In the pasts especially, habits related to religion were also really important to schedule the daily lifes of the peasants and citizens.
I think that another difference between animal and human habits is that "habit"is a word that can be applied only to animals, while to describes human beings' ones you have a broader choice of words such as "routine", "addiction", "ritual". That might be related to the fact that there is only one purpose in animals' habits, survival, while humans' have more that one aim: Humans' habits are not that essential to survival, in some cases (smoking) they are actually decreasing our chance of living a long healthy life and to have healthy, strong offspring.
Both for animals and for humans, Emotions and instincts more than reason is behind the need for habits; especially for humans, constantly on the search for meaning and order in a world that can seem so wide, chaotic and incomprehensible, habits set firm points in their lifes, giving them a sense of control over their own life, making them feel like they have the power, and the freedom, to choose.