Wa `alaykum As-Salamu waRahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Answering your question, the Fatwa Center at Islam Q and A, states:
The period of itikaf during the (last) ten nights of Ramadan ends when the sun sets on the last day of the month.
If one chooses to stay until he has prayed Fajr and then depart from his place of itikaf to the Eid prayer, there is nothing wrong with that. Some of the scholars regarded that as recommended. (Fatawa al-Lajnah al-Da’imah, 10/441)
Imam Malik (may Allah be pleased with him) said that he saw that some of the scholars who had observed itikaf during the last ten nights of Ramadan did not go back to their families until they had attended the prayer of Eid Al-Fitr with the people. Malik said: I heard that from the righteous people who have passed on, and this is the dearest to me of what I have heard about that.
Imam Al-Nawawi said:
“Ash-Shafi`i and his companions said: Whoever would like to follow the example of the Prophet (peace and blessings of Allah be upon him) in observing itikaf during the last ten nights of Ramadan should enter the mosque before the sun sets on the night of the twenty-first, so that he will not miss any of it, and he should come out after the sun sets on the night of Eid, whether the month is twenty-nine days or thirty. It is better for him to stay in the mosque on the night of Eid so that he can offer the Eid prayer there, or go out to the Eid prayer-place if they pray Eid there.
Allah Almighty knows best.