Please contribute generously in order to ensure the continuity of our website InshaAllah.
Praise be to Allah.
The correct scholarly view is that whatever the one who joins the prayer late catches up with with the imam is the beginning of his prayer, and whatever he does on his own is the end of his prayer. This is the view of ash-Shaafa‘i (may Allah have mercy on him), and was narrated in one report from Ahmad (may Allah have mercy on him). See: al-Majmoo‘ by an-Nawawi (4/420).
The proof for that is the words of the Prophet (blessings and peace of Allah be upon him): “When the iqaamah for prayer is given, do not come rushing. Rather come walking, in a tranquil manner; whatever you catch up with, pray, and whatever you miss, complete it.”
Narrated by al-Bukhaari (636) and Muslim (602).
What this means is that what the one who joins the prayer late catches up with with the imam is the beginning of his prayer.
See also the answer to question no. 49037.
There is no differentiation in this regard between the obligatory prayers, the Eid prayer, prayer for rain or any other prayer. If the one who is praying behind the imam catches up with a rak‘ah of Eid prayer, then that is the beginning of the prayer in his case; then he should get up after the imam says the salaam and do the second rak‘ah, saying takbeer five times at the beginning of it, because it is the second rak‘ah in his case.
If he catches up with a rak‘ah of the prayer for rain, he should also stand up and do another rak‘ah, saying takbeer five times at the beginning of it, because it is the second rak‘ah in his case.
If he catches up with the prostration in the second rak‘ah, or he catches up with the final tashahhud, he should get up and do two rak‘ahs, saying takbeer seven or six times in the first rak‘ah, after the opening takbeer, and five times in the second rak‘ah after the takbeer of standing.
And Allah knows best.