Muhammad was suffering from the disease of superstitions, just like other people in his Arab society of the time of ignorance, and there was no Allah present in the heavens, who could have taken him out of this disease of superstitions.
Muhammad (like other people of his society) believed in Satan (actually many small satans/jinns), black magic, spirits, evil eye etc.
The case of the evil eye is a little special.
Why?
Because Muhammad thought that, unlike black magic (which is done by evil people), an evil eye can also be caused by a good Muslim without any evil intentions.
For example, let us see the following Hadith.
Abu Umama b. Sahl b. Hunaif told that ‘Amir b. Rabi'a saw Sahl b. Hunaif bathing and said, “I swear by God that I have seen no skin to compare with what I have seen to-day, not even that of a secluded girl.” Sahl fell to the ground (due to tha evil eye) and people went to God’s messenger and said to him, “Messenger of God, can you do anything for Sahl b. Hunaif? We swear by God that he cannot raise his head ” He asked if they suspected anyone, and when they replied that they suspected ‘Amir b. Rabl‘a. God’s messenger summoned ‘Amir, and speaking roughly to him, said, “.. Bathe on his behalf ” ‘Amir then washed on his behalf his face, hands, elbows, knees and toes, and inside his lower garment (i.e. his Penis & Anus), collected the water in a vessel and poured it over him, so he recovered and went away with the people none the worse.
Grading: SAHIH (Albani)
Alone believing in any Evil Eye is ignorance, but the order to wash the Penis and Anus and to pour upon the ill person is literally the PEAK of Ignorance.
Moreover, the even more ridiculous thing is that according to Muhammad, a good person can also cause harm through the evil eye, even without evil intentions.
That is why it is written under the commentary of this Hadith (link):
Qadhi Ayadh said: If a (Muslim) person becomes famous for causing harm to others through an evil eye, then it is necessary to take precautions in his presence. And the Ruler of state has to put restrictions upon him so that he cannot move in public, and he should stay only in his house. And if he is compelled to beg for food in order to survive, then the Ruler of the state has to give him money from Bait-ul-Mal (so that he does not need to go to people in order to beg for food). Imam Nawawi also agreed with this saying of Qadhi Ayaad.
Although Muhammad declared tons of times Evil Eye is a reality in Sahih Bukhari and Sahih Muslim (link), this is such a ridiculous thing that educated Muslims themselves don't believe in any evil eye (or even in black magic) today.
The lesson is, there is no divine Allah present in the heavens, and it was Muhammad himself who was making revelations on his own, and that is why we see such human errors of superstitions in Islamic revelations.
An Excuse by Islam apologist:
One Islam apologist came up with this excuse that the method (of washing the penis and anus) was later abrogated with the revelation of Surah al-Falq and Suran an-Nas (the last 2 Surahs of the Quran, which are together known as al-Mu'awwidhatain). And he presented the following tradition:
Abu Sa'eed narrated: "The Messenger of Allah(S.A.W) would seek refuge from the jinn and the (evil) eye of humans, until Al-Mu'awwidhatain were revealed. So when they were revealed he used them and left other than them."Grading: Weak (Darussalam)
Firstly: How can Islam apologists present a tradition which is WEAK according to their own standards?
Secondly: Even if we consider this tradition to be authentic, that all other ways of curing an evil eye were abrogated after the revelation of these two Surahs, still Islam cannot become free of charge that it was initially asking people to wash the penis and anus and pour that water as a cure. Muhammad had already been a prophet at that time too when he first ordered the water, that was used for washing of penis and anus, which means he received those orders too directly from Allah.
Therefore, if any Allah is really present in the heavens, then He should have revealed PERFECT revelation at the very first time and not such orders which consisted of ignorant superstitions and devoid of any WISDOM. Later, the abrogation of such useless revelation is in itself proof that no Allah is present in the heavens, but any human was making the revelations on his own, and thus he had to abrogate the useless revelations and to make new revelations in order to cover up his human mistakes.
Thirdly: The largest Saudi Salafi website Islam Q & A (link) writes that this Hadith about Al-Mu'awwidhatain is false, while those 2 Surahs (i.e. Al-Mu'awwidhatain) had already been revealed during the Meccan period. But according to the other Sahih traditions, the prophet used other ways for curing people against the evil eye. For example, Hassan and Hussain were born during the Medinan period and the prophet used other ways to cure them against the evil eyes (Sahih Bukhari, 3371).
The incident of Sahl bin Hunaif itself happened later during the Medinan period (as Sahl was himself an Ansari Muslim)
Fourthly: None of the Sahaba knew about the abrogation of other ways other than Al-Mu'awwidhatain. Thus, Sahaba were using many other ways to cure the evil eye, even long after the death of the prophet. For example:
Narrated IsraiI: `Uthman bin `Abdullah bin Mauhab said, "My people sent me with a bowl of water to Um Salama." Isra'il approximated three fingers ('indicating the small size of the container in which there was some hair of the Prophet. `Uthman added, "If any person suffered from evil eye or some other disease, he would send a vessel (containing water) to Um Salama. I looked into the container (that held the hair of the Prophet) and saw a few red hairs (of the Prophet) in it,"
There are tons of Ahadith where Sahaba used other ways of treating evil eye than Al-Mu'awwidhatain.