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. 

Mishkat al-Masabih, 4562:

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.

GradingSAHIH (Albani)

Belief in the concept of the evil eye is itself rooted in ignorance, but prescribing actions such as washing the private parts and pouring water over the affected person reaches an extreme level of superstition.

What makes this even more irrational is the claim that, according to Muhammad, a good person can unintentionally cause harm through the evil eye, even without malicious intent.

This idea is further elaborated in the commentary on the 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 repeatedly acknowledged the reality of the Evil Eye in both Sahih Bukhari and Sahih Muslim (source), it's such a widely considered ridiculous belief today that even educated Muslims do not hold faith in the concept of the evil eye (or black magic).

The lesson here is that there is no divine Allah present in the heavens, and it was Muhammad himself who made these revelations. This is why we observe human errors and superstitions in Islamic teachings.

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:

 Jami` at-Tirmidhi 2058:

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 accept this tradition as authentic—acknowledging that all other methods for curing the evil eye were abrogated after the revelation of these two Surahs—Islam cannot absolve itself of the charge that initially it was instructing people to wash their penis and anus and use that water as a cure. Muhammad had already been a prophet at the time when he first ordered the use of water, which was intended for washing the penis and anus, indicating that these instructions were received directly from Allah.

Therefore, if a divine Allah truly exists in the heavens, He should have revealed a PERFECT revelation from the outset, not one full of ignorant superstitions devoid of any WISDOM. The later abrogation of such revelations serves as proof in itself that no Allah was present in the heavens and that revelations were being made by a human, who had to rectify his earlier mistakes by issuing new directives.

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 companions knew about the abrogation of other ways other than Al-Mu'awwidhatain. Thus, companions were using many other ways to cure the evil eye, even long after the death of the prophet. For example:

Sahih Bukhari, 5896:

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.