Praise be to Allah.
I’tikaf is Sunnah at any time, in Ramadan or otherwise, but it is better in Ramadan, especially in the last ten days of Ramadan.
This is indicated by the general meaning of the evidence which speaks of i'tikaf being mustahabb, which includes Ramadan and other times.
Al-Nawawi said in al-Majmu’ (6/501):
“I’tikaf is Sunnah according to consensus, and it is not obligatory unless one vowed to do it – also according to consensus. It is mustahabb to do it a great deal and it is mustahabb especially in the last ten days of Ramadan.”
He also said (6/514):
“The best i’tikaf is that which is accompanied by fasting, and the best of that is in Ramadan, and the best of that is the last ten days.”
Al-Albani said in Qiyam Ramadan:
“I'tikaf is Sunnah in Ramadan and at other times of the year. The basis for that is the verse in which Allah says (interpretation of the meaning):
“…while you are in I‘tikaf (i.e. confining oneself in a mosque for prayers and invocations leaving the worldly activities) in the mosques.” [al-Baqarah 2:187]
And there are sahih ahadith which describe the Prophet (peace and blessings of Allah be upon him) observing i’tikaf as well as numerous reports which describe the salaf as doing so too.
It was proven that the Prophet (peace and blessings of Allah be upon him) observed i’tikaf during ten days of Shawwal as well. This is agreed upon.
‘Umar said to the Prophet (peace and blessings of Allah be upon him): “During the Jahiliyyah I vowed to observe i’tikaf for one night in al-Masjid al-Haram.” He said: “Fulfill your vow.” So he [‘Umar] observed itikaf for one night. Agreed upon.
It is more emphasized in Ramadan, because of the hadith of Abu Hurayrah: The Messenger of Allah (peace and blessings of Allah be upon him) used to observe i’tikaf for ten days every Ramadan, and in the year in which he passed away he observed i’tikaf for twenty days. Narrated by al-Bukhari.
The best i’tikaf is at the end of Ramadan, because the Prophet (peace and blessings of Allah be upon him) used to observe i’tikaf for the last ten days of Ramadan until he passed away. Agreed upon.”
Shaykh Ibn Baz said in Majmu’ al-Fatawa (15/437):
“Undoubtedly i'tikaf in the mosque is an act of worship, and (observing it) in Ramadan is better than at other times. It is prescribed in Ramadan and at other times.”
For more, please see Fiqh al-I’tikaf by Dr Khalid al-Mushayqih, p. 41.