Ivan pavlov introduced the concept of CONDITIONING when he taught a dog to salivate at the sound of tuning fork
The same condition happen to human. Our brain response to our exact habitual conditioning that's why sometimes it's very hard to lose/change a habit.
For example, if you condition yourself that you need to hold some sort of doll before you went to sleep, it will be hard for you to sleep if somehow that doll is not in your possession