Fiqh-us-Sunnah Volume 3, Zakaat and Fasting, Fiqh 3.149.
It can be fulfilled by staying in the mosque with the intention of making i’tikaf for a long or short time. The reward will be according to how long one stays in the mosque. If one leaves the mosque and then returns, he should renew his intention to perform i’tikaf. Ya’la ibn Umayyah said: “I secluded myself in the mosque for some time for i’tikaf.” ‘Ata told him: “That is i’tikaf, as long as you secluded yourself there. If you sit in the mosque hoping for good, it is i’tikaf. Otherwise, it is not.” One who is performing the non-obligatory i’tikaf may end his i’tikaf at any time, even if it is before the period he intended to stay. ‘Aishah related that if the Prophet intended to make i’tikaf, he would pray the morning prayer and begin it. One time he wanted to make i’tikaf during the last ten nights of Ramadan, and he ordered his tent to be set up. Aishah reported: “When I saw that, I ordered my tent to be set up, and some of the Prophets wives followed suit. When he [the Prophet] prayed the morning prayer, he saw all of the tents, and said: “What is this?” They said: “We are seeking obedience [to Allah and His Messenger].” Then he ordered his tent and those of his wives to be taken down, and he delayed his i’tikaf to the first ten days [of Shawwal].” The fact that the messenger of Allah ordered his wives’ tents to be struck down and asked them to leave the i’tikaf after they have made the intention for it shows that they discarded the i’tikaf after they had begun it. The hadith also shows that a man may prevent his wife from performing i’tikaf if she did not get his permission to perform it. There is a difference of opinion over the case of the man granting permission to his wife and then rescinding it. According to ashShaf’i, Ahmad, and Dawud, this is permissible for the husband, and the wife must leave her i’tikaf in such case.