All the behaviours that keep on repeating itself are caused by the neurons residing in the brain which release memories according to our situation and environmental need.

Our subconscious mind is where these repetitive behaviours are recollected and the cognitive mind is the one where our thoughts reside for a short while, but most of the time these thought stay there up to five days. That is the main reason why most of the students don’t remember after few days of examination.
If you want to change your behaviour then always start with cognitive mind then later on build that memory in subconscious. Once your thoughts are completely incorporated into the subconscious mind and taken by your cognitive mind, that conduct or thought now becomes part of your personal life.
This process takes some time and effort but it is not impossible by any means. It is important to understand that there is no magic formula for this. As all of your thoughts need electrical signals and fully developed neural networks to reside.
Things that happen before your eyes stay in the cognitive part of your mind and the rest of non-cognitive mind is called subconscious mind. Subconscious mind is also sometimes referred as unconscious mind. That subconscious or unconscious mind resides mostly in brain matter.
The process of building the subconscious mind involves construction of biological neural connections in its neural cells. There are two main parts of this process, repetition and emotional content. The biological neural connections and only be formed if these two things occur simultaneously.
Minimum of 4 days are needed for our brain to decide to create a neural network for a particular thought or memory. It can only be achieved by constant repetition of that memory. Once the brain decides to form a neural network, it requires more or less 21 days of repetition for this neural network to be fully constructed. In order to integrate that memory into thought process, it requires about 40 days. This explains how a new habit can be developed which is also backed by neural network.
Sometimes, we want to remove our bad habits or past memories from the cognitive mind. As these thoughts are already part of the neural connection and mostly dominate, it is very important to associate new thoughts and emotions with them. After a neural connection has been developed, it is impossible to delete that though, however you can associate new thoughts and memories with it. However, it is only possible with 90 day repetition. If you are unsuccessful in doing so, then both, new and old memories will become part of your cognitive mind. Out of these two, older thoughts and memories will always have a greater impact.
It is believed that our whole body can contain neural connections equivalent to over 10,000 years of active memory.