Tanhuma Yashan Shmot 5
Everything the Egyptians thought to do to Israel, the Holy Blessed One brought onto them. They thought to kill them, the Holy Blessed One killed their firstborn.
And all the first-born in the land of Egypt shall die, from the first-born of Pharaoh who sits on his throne, even unto the first-born of the maid-servant that is behind the mill; and all the first-born of cattle.
Why are the slaves included [actually not in this verse, but another one]? So they wouldn’t say that their god had had claimed points for the humiliation imposed on the Egyptians.
Why are the maid-servants included? Because they treated the Israelites as slaves and rejoiced in their misery.
All the first born gathered at their fathers’ homes and said to them, ‘everything which Moses has said has happened to us, don’t you want to let them go? Come, send out these slaves from among us, for if we don’t we will die.’ They replied to them, ‘even if all of Egypt dies, we won’t let them leave this place.’
What did they do? All the first born came together and went to Pharaoh and said to him, ‘We plead with you, get rid of this people, for because of them this evil has befallen us, and you.’
He said to them, ‘Smash the shins of these slaves.’
What did the first born do? Immediately they took swords and each of them killed their own father [The Midrash works a verse Ps 136:10 to suggest that ‘the plague of the first born’ suggests that the first born enacted the plague.
Pesikta D’Rav Kahana 7
If a person sins [fine], but how can cattle sin? Rather the Egyptians would worship spotted sheep and goats, and so they wouldn’t say, ‘that which we revere brought this punishment upon us.’
And there was a great cry in all of the land of Egypt.
They say that at the time Moses said there would be a great cry in all the land of Egypt a zekinah went out to meet him. She said to him, ‘You are a deceitful prophet. A zekinah who has no father, no mother, no brother, no sister, no son, no daughter – what’s she going to cry for. He said to her, ‘avodah brings your cry to theirs. They said, she had a son once who died. He made a lifelike portrait in the image of her son. And every day after she had eaten and drank, she would go and dance before it. On that night the dogs came and ripped it up. And she wailed and wept and cried – to fulfil that which is written ‘And there was a great cry in all of the land of Egypt.’
And it was at the half-way point of the night that God struck all the firstborn in the land of Egypt from the firstborn of Pharaoh on the throne to the firstborn of the slave in the dungeon.
Tanhuma Yashan Bo 17
Rabbi Eliezer Ben Padat said, that every time a verse has the phrase ‘and it was’ it means to include God’s court. God would sit with them in justice and the heavenly court decreed that the firstborn of Egypt should be struck, thus the verse states ‘and it was at the half-way point of the night.’
But wasn’t Pharaoh himself a firstborn? But he was left from among the firstborn.