The book of King Solomon reveals that there are two levels by the door one on the right and one on the left. A demon with permission to inflict judgment may find a way to come and harm those who dwell in the house. He waits by the left side of the door. When a person looks at the Mezuzah that is on the right, the name of God comes into his mind and the demon cannot harm him.
The Mezuzah also protects the person when he leaves his home. The Mezuzah is now on the left of the person and the demon is on his right.
We have the good inclination on the Right and on the Left we have the evil inclination. The demon is drawn to the left of the person where he sees the evil inclination. When he sees the Mezuzah on the right with the name of God he is pushed away. Because the Right controls the Left, that person is saved from judgments.
Demons are negative entities created by negative actions. Those were created by us are close to us and can harm us when we our ‘shield’ of light is weak and they can harm us. They are sustained by our negative actions and once created they will push us to do negative actions and enjoy their existence.
The way to ‘starve’ them to non-existence is by following the law of Torah and increasing our light shield with Torah/Zohar studies and giving Tzedaka.
When we study they are not allowed to touch us. The Mezuzah is a connection to the Torah and the demons created at home and wait by the door are not allowed to harm us.
Peaceful home and good Mezuzah is the best protection.