I don’t know the background of ayin hora, but I am looking forward to the responses.
It is my understanding that Yosef was impervious to the ayin hora. I think he merited that by standing in front of, and guarding, his mother from being seen by someone with wrong intentions.
BTGuy: You are correct it has to do with Yosef. In mesheches Berachos 20 R’Yochanon said he descended from Yosef and said he was above ayin hara(see in gemara how the dialogue began).R’Avahu explains the bracha Yosef got alei ayin is read olei ayin(above the eye)and R’Yossi bar Channina says from the bracha of Yosef’s children v’yigdul larov,just like the fish are covered by water and cannot be seen by the eye so too the children of Yosef.Also Yosef did not look at what was forbidden to him ,so to he is above.
The Gemara is full of the concept of Ayin Hara. It affects Halacha and Hanhaga in many areas.
The basic idea is that people’s will have a big effect. The Sefer Chasidim says that those that are hated by the public (e.g. tax collectors) don’t live long. This is built into the world.