How Did Prophet Muhammad Perform I’tikaf?
Question

I would like to know the guidance of the Prophet (peace and blessings of Allah be upon him) with regard to i’tikaf.
Praise be to Allah.The guidance of the Prophet (peace and blessings of Allah be upon him) with regard to i'tikaf was the most perfect and moderate of guidance. 

Once he observed i'tikaf in the first ten days of Ramadan, then in the middle ten days, seeking Laylat al-Qadr . Then he was told that it is in the last ten days, so then he always observed i'tikaf during the last ten days, until he met his Lord. 
On one occasion he did not observe i’tikaf during the last ten days, so he made it up in Shawwal and observed i'tikaf during the first ten days thereof. This was narrated by al-Bukhari and Muslim. In the year in which he died, he observed i’tikaf for twenty days. Narrated by al-Bukhari, 2040. 

“It was said that the reason for that is that he knew his life was drawing to a close, so he wanted to increase his good deeds, to show his ummah how to strive hard in doing good deeds when the opportunity for doing so drew to close, so that they could meet Allah in the best way. And it was said that the reason was that Jibril used to review the Quran with him once each Ramadan, but in the year in which he died, he reviewed it with him twice, which is why his i’tikaf was twice as long as usual. 
A more likely reason is that he observed i’tikaf for twenty days in that year because the year before he had been traveling. This is indicated by the report narrated by al-Nasai and Abu Dawud, and classed as sahih by Ibn Hibban and others, from Ubayy ibn Ka’b who said: The Prophet (peace and blessings of Allah be upon him) used to observe i’tikaf during the last ten days of Ramadan, but he travelled one year and did not observe i’tikaf , so the following year he observed i’tikaf for twenty days.” (Fath al-Bari) 

The Prophet (peace and blessings of Allah be upon him) used to order that a kind of tent be pitched for him in the mosque, and he would stay in it, keeping away from people and turning to his Lord, so he could be on his own with his Lord in a true sense of the word. 
On one occasion he observed i’tikaf in a small tent, and put a reed mat over the door. Narrated by Muslim, 1167. 

Ibn al-Qayyim said in Zad al-Ma'ad, 2/90: 
“All of this to achieve the spirit and purpose of i’tikaf, and is the opposite of what the ignorant do, whereby the place of i’tikaf becomes a place of gathering and meeting with people and chatting to them. This is one thing, and i’tikaf as observed by the Prophet (peace and blessings of Allah be upon him) is something else.” 

He used to stay in the mosque the whole time , and not leave it except to relieve himself. ‘Aishah (may Allah be pleased with her) said: “He would not enter his house for anything except for a need when he was observing i’tikaf.” Narrated by al-Bukhari, 2029; Muslim, 297. According to a report narrated by Muslim: “Except for human needs.” Al-Zuhri interpreted this as referring to urination and defecation. 
He (peace and blessings of Allah be upon him) made sure he remained clean. He would lean his head out of the mosque into `Aishah’s apartment so that she should wash his head and comb his hair. 

Al-Bukhari (2028) and Muslim (297) narrated that `Aishah (may Allah be pleased with her) said: “The Prophet (peace and blessings of Allah be upon him) used to lean his head towards me when he was observing i’tikaf in the mosque, and I would comb his hair, when I was menstruating.” According to a report also narrated by al-Bukhari: “And I would wash it.” 
Al-Hafiz said: 
This hadith indicates that it is permissible to clean oneself, put on perfume, wash oneself, comb one’s hair etc (when in i’tikaf). The majority of scholars are of the view that nothing is makruh except that which it is makruh to do in the mosque. 

When he was in i’tikaf, the Prophet (peace and blessings of Allah be upon him) did not visit the sick or attend funerals . This was so that he could concentrate fully on conversing with Allah and achieving the purpose of i’tikaf, which is to cut oneself off from people and turn to Allah. 

`Aishah said: The Sunnah is for the person in i’tikaf not to visit the sick or attend funerals, or to be intimate with his wife. But there is nothing wrong with his going out for essential needs. (Narrated by Abu Dawud, 2473; classed as sahih by al-Albani in Sahih Abi Dawud.) 
“or to be intimate with his wife” means intercourse. This was stated by al-Shawkani in Nayl al-Awtar. 

Some of his wives used to visit him when he was in i’tikaf. When she stood up to leave, he would take her home – that was at night. 

It was narrated from Safiyyah the wife of the Prophet (peace and blessings of Allah be upon him) that she came to the Messenger of Allah (peace and blessings of Allah be upon him) and visited him when he was in i’tikaf in the mosque, during the last ten days of Ramadan. She spoke with him for a while, then she stood up to leave. The Prophet (peace and blessings of Allah be upon him) stood up with her to take her home. (Narrated by al-Bukhari, 2035; Muslim, 2175) 

In conclusion, his i’tikaf was moderate and not harsh. He spent all his time remembering Allah and turning to Him in worship, seeking Laylat al-Qadr. 

References: 
Zad al-Ma Aad by Ibn al-Qayyim, 2/90; 
Al-I’tikaf: Nazrah Tarbawiyyah by Dr ‘Abd al-Latif Balto.
For more, please see this category: I’tikaf.
And Allah knows best.