How is the eclipse prayer offered?

Praise
be to Allah

Firstly:

al-Bukhaari
(1041) and Muslim (911)
narrated that Abu Mas‘ood al-Ansaari (may Allah be pleased with him) said:
The Messenger of Allah (blessings and peace of Allah be upon him) said: “The
sun and the moon are two of the signs of Allah by means of which Allah
creates fear in His slaves. They do not become eclipsed for the death of any
person. If you see anything happen to them, then pray and call upon Allah
until you are relieved of that.”

Al-Bukhaari
(1059) and Muslim (912) narrated that Abu Moosa (may Allah be pleased with
him) said: The sun was eclipsed, and the Prophet (blessings and peace of
Allah be upon him) got up in a state of anxiety, thinking that it was the
Hour. He came to the mosque and began to pray, standing, bowing and
prostrating for the longest time I ever saw him do, and he said: “These
signs that are sent do not occur for the death or birth of anyone, rather
Allah sends them to create fear in His slaves. If you see any of them, then
hasten to remember Him, call upon Him and ask Him for forgiveness.”

Secondly:

The way in which
the eclipse prayer is performed is as follows:

The worshipper
recites the opening takbeer (takbeerat al-ihram) and the opening
supplication (du‘aa’ al-istiftaah), then he seeks refuge with Allah.

Then he recites
al-Faatihah, followed by a lengthy recitation.

Then he bows,
making it lengthy.

Then he rises
from bowing and says: Sami‘a Allahu liman hamidah, Rabbana wa laka al-hamd
(Allah hears those who call upon him; our Lord, to You be praise).

Then he recites
al-Faatihah again, followed by another lengthy recitation but it is not as
long as the first recitation.

Then he bows
again, making it lengthy but not as long as the first time.

 Then he rises
from bowing and says: Sami‘a Allahu liman hamidah, Rabbana wa laka al-hamd
(Allah hears those who call upon him; our Lord, to You be praise), and
stands for a long time.

Then he
prostrates twice, making each prostration lengthy, and sits for a long time
between the two prostrations.

Then he gets up
for the second rak‘ah, and does the same as he did in the first rak‘ah,
bowing twice and so on, but each action is not as long as in the first. Then
he recites the tashahhud and the tasleem.

See al-Mughni
by Ibn Qudaamah (3/323); al-Majmoo‘ by an-Nawawi (5/48).

This is
indicated by the hadith of ‘Aa’ishah. Al-Bukhaari (1046) and Muslim (2129)
narrated that ‘Aa’ishah, the wife of the Prophet (blessings and peace of
Allah be upon him) said: The sun was eclipsed during the lifetime of the
Messenger of Allah (blessings and peace of Allah be upon him). The Messenger
of Allah (blessings and peace of Allah be upon him) went out to the mosque
and stood and said takbeer, and the people formed rows behind him. The
Messenger of Allah (blessings and peace of Allah be upon him) recited for a
long time, then he said takbeer and bowed for a long time. Then he said,
“Sami‘a Allahu liman hamidah  (Allah hears those who praise Him).”

Then he stood
and did not prostrate, and recited for a long time, but it was shorter than
the first time.

Then he said
takbeer and bowed for a long time, but it was shorter than the first time.

Then he said,
“Sami‘a Allahu liman hamidah, Rabbana wa laka al-hamd (Allah hears those who
call upon him; our Lord, to You be praise).”

Then he
prostrated. Then he did likewise in the second rak’ah.

Thus he did four
bowings and four prostrations.

And Allah knows
best.