The word eclipse has 2 meanings: firstly, an occasion when the sun looks like it is completely or partially covered with a dark circle because the moon is between the sun and the Earth. Secondly, an occasion when the moon looks like it is completely or partially covered with a dark circle because the Earth's shadow is on it. 
OR An eclipse is the total or partial obscuring of one celestial body by another. It may occur when one celestial body passes in front of another therefore cutting off some or all of its light. It may also occur when a celestial body passes through all or part off the shadow of another celestial body.
It is an amazing coincidence that total solar eclipses actually occur. It is all due to size and distance between all three celestial bodies of the Sun, Moon and Earth; all being (as the Goldilocks Principle says) it's just right.
1. Solar Eclipses - There are four types of solar eclipse - A Solar eclipse can be Total, Annular, Partial or Hybrid
2. Lunar Eclipses - Astronomers recognise three basic types of lunar eclipse - Total, Partial and Penumbral. However there is a rare forth variation known as a Total Penumbral Lunar Eclipse
A Total Solar Eclipse only occurs when the Moon is at or very near perigee (closest distance to Earth) and all three bodies of the Sun, Moon, and Earth are in alignment. When the Moon is at apogee (furthest distance from Earth) it is 11% more distant from Earth than it is a perigee, this makes the apparent size of the Moon slightly smaller in diameter. The difference is small but is enough to change the characteristics of a solar eclipse, resulting in that even if all three bodies of the Sun, Moon and Earth are in perfect alignment, the Moon’s diameter still remains too small to cover the disc of the Sun and an annular eclipse will occur. 
“Indeed your Lord is Allah, Who created the heavens & the earth in Six Days and then He rose over The Throne. He brings the night as a cover over the day, seeking it rapidly, and the sun, the moon, the stars subjected to His Command. Surely, His is the Creation & the Commandment. Blessed is Allah, the Lord of the Aalameen.”Qur’an Surah Al-A’raf 7:54
“And of His signs are the night and day and the sun and moon. Do not prostrate to the sun or to the moon, but prostate to Allah , who created them, if it should be Him that you worship.” Qur’an Surah Fusilat 41:37
Muslims are supposed to keep the above mentioned ayath in our minds. We should look around ourselves, to observe the creations of Allah and keep praising Him.
Modern scientists have their own explanation about the reasons behind the occurrence of eclipses. Whatever be the reasons given by science, the fact is what is explained in the above mentioned verse of Qur’an; the eclipses (solar or lunar) both occur as per the commands of Allah. And following hadith tells us why Allah makes them take place.
Narrated Abu Bakr (RA): Allah’s Messenger ﷺsaid: “The sun & the moon are the two signs of Allah and they do not eclipse because of the death of someone, but they are two signs amongst the signs of Allah. When you see them stand up and pray." Book of The Eclipses, Sahih Bukhari, Vol. 2: Hadith No. 1041
Narrated Al-Mughira bin Shu’ba (RA): The sun eclipsed in the lifetime of Allah’s Messenger ﷺon the day when Ibrahim (his son) died. So, the people said that the sun had eclipsed because of the death of Ibrahim. Allah’s Messenger ﷺsaid: “The sun & the moon do not eclipse because of death or life of someone. When you see the eclipse, offer Salat & invoke Allah.” Book of The Eclipses, Sahih Bukhari, Vol. 2: Hadith No. 1043
The Salat offered during the eclipse is known as Salat Al-Kusuf. Details about Salat Al-Kusuf is discussed below. Before that, let us see what are the other things supposed to be done during an eclipse which is proven from sunnah.
It is recommended to give charity during an eclipse. Refer to the following hadith - Aishah (RA) narrated that The Prophet ﷺsaid: “The sun and the moon do not eclipse due to the life or death of anyone. So when you witness it, supplicate to Allah, the Mighty & Sublime, say the Takbir and give charity.” Book of The Prayer for Rain, Sunan Abu Dawud, Vol. 2: Hadith No. 1191
Another thing recommended to do during an eclipse is to free slaves This practise may not be that much applicable to present times, but still can be applied to other similar situations. Asma narrated: “The Prophet ﷺwould command that slaves be freed during the eclipse prayer.”Book of The Prayer for Rain, Sunan Abu Dawud, Vol. 2: Hadith No. 1192
We can see that the above mentioned narration tells us that Allah’s Messenger ﷺcommanded people to do so.
Most of the ahadith discussed above tell us that we should invoke Allah by different means of Ibadah during an eclipse, and ask Allah for His forgiveness. Other narrations tell us that one should particularly seek Allah’s forgiveness from the torments of the grave.
First thing to be remembered about this Salat is that it should be offered in congregation. Following hadith shall tell us that a call for Salat Al-Kusuf used to be made during lifetime of Allah’s Messenger ﷺ. However, there is no Adhan for this Salat, neither Iqamah is pronounced for it.
Narrated Abdullah bin Amr (RA): When the sun eclipsed in the lifetime of Allah’s Messenger ﷺ, a loud announcement was made: As-Salatu-Jamia (prayer to be offered in congregation). Book of The Eclipses, Sahih Bukhari, Vol. 2: Hadith No. 1045
One should remember that if someone lives in a place where it is not possible to hold Salat Al-Kusuf in congregation, due to some genuine reason, the person may offer it individually.
Let us go through following two narrations to understand this: Urwah bin Az-Zubair (RA) reported from Aishah (RA), the wife of The Prophet ﷺ, that she said: “There was a solar eclipse during the lifetime of Allah’s Messenger ﷺ. So, The Prophet ﷺwent to the Masjid, stood up and said the Takbir, and the people lined up (in rows) behind him. Allah’s Messenger ﷺrecited (the Qur’an) for a long time, then said the Takbir and went intoRuku’ for a long time. Then he raised his head & said: ‘Sami Allahu liman hamidah, Rabbana walakal Hamd.’ So he stood up and recited a lengthy recitation, which was not as long as the first recitation. Then he said the Takbir and went into Ruku’ for a long time, but not as lengthy as the first Ruku’. Then he said: ‘Sami Allahu liman hamidah,’ and he repeated the same acts in the other raka’at. So he completed four Ruku’ and four prostrations (Sujood), and the sun had become visible before he finished.”Book of The Prayer for Rain, Sunan Abu Dawud, Vol. 2: Hadith No. 1180
Before reaching any inference, let us go through one more hadith on this. Tawus reported from Ibn Abbas (RA) from the Prophet ﷺ, that he prayed during a solar eclipse. He recited (the Qur’an), then went into Ruku’, then recited, then went into Ruku’, then recited, then went into Ruku’, then recited, then went into Ruku’. Then he prostrated, and he prayed the second raka’at in a similar fashion. Book of The Prayer for Rain, Sunan Abu Dawud, Vol. 2: Hadith No. 1183
The above mentioned two narrations explain the procedure of Salat Al-Kusuf clearly for us. We can summarize as:
a) Two raka’at are prayed in Salat Al-Kusuf.
b) Each raka’at consists of either two or four Ruku’ and two prostrations.It is up to us to make either two Ruku’ and two prostrations in each raka’at or four Ruku’ and two prostrations in each raka’at, both options are correct.
Once two raka’at of the Salat are completed, the Imam should deliver a Khutba (i.e. a religious sermon, public speech). This is the way of our beloved Prophet ﷺ.
Asma said, “Allah’s Messenger ﷺfinished the eclipse prayer and by then the sun (eclipse) had cleared. Then he delivered the Khutba and praised Allah as He deserves & then said ‘Amma ba’du.”Book of The Eclipses, Sahih Bukhari, Vol. 2: Hadith No. 1061
There are narrations that tell us that Allah’s Messenger ﷺwives used to offer Salat Al-Kusuf with Allah’s Messenger ﷺ, as mentioned in Book of The Eclipses, Sahih Bukhari, Vol. 2: Hadith No. 1053
When the next eclipse takes place, May Allah guide us to follow the teachings what our beloved Prophet ﷺasked us to do.