I am wondering about what the Orthodox Jewish view is on the the afterlife. Why do Orthodox Jews pray for the dead? I know that there are prayers said for the dead in the Jewish tradition, but I don't know what they specifically refer to or why they are said.
Since no one has ever died and come back to tell their tale, no one knows for sure what happens after you die, but there are stories in the Talmud and other Jewish texts that give us a hint of what Olam Haba (The World to Come) might be like. I actually have an upcoming video on this subject, so I'll tell you one parable here, but stay tuned for further information in the video.
I once heard a story in which the recently departed entered a room and saw a lavishly covered table with all sorts of treats and delicacies. The people sitting around it, however, were skinny and starving with sunken-in faces and looks of desperation in their eyes, because despite all the food that was laid out in front of them, their elbows were locked, rendering their arms useless. No matter how hard they tried, they could not get the food into their mouths.
The man then entered a second room and saw a table with the same lavish spread, but the people around this table looked healthy, happy, and well-feed. For though their elbows were similarly locked stiff, the people around this table were feeding each other.
What we can see from this story is that Olam Haba seems to be the same place for all who pass into it, but will be experienced differently depending on how the individual worked on herself in this world.
Now in terms of the second part of your question, regarding prayers for the dead, although there is a prayer that mourners say when a loved one has passed, the prayer itself actually has nothing to do with death. It's called the Mourner's Kaddish and is translated below:
Glorified and sanctified be God’s great name throughout the world which He has created according to His will. May He establish His kingdom in your lifetime and during your days, and within the life of the entire House of Israel, speedily and soon; and say, Amen.
May His great name be blessed forever and to all eternity.
Blessed and praised, glorified and exalted, extolled and honored, adored and lauded be the name of the Holy One, blessed be He, beyond all the blessings and hymns, praises and consolations that are ever spoken in the world; and say, Amen.
May there be abundant peace from heaven, and life, for us
and for all Israel; and say, Amen.
He who creates peace in His celestial heights, may He create peace for us and for all Israel; and say, Amen.
Since this prayer makes no mention of death, but only praises God and His will, it seems to me that the lesson behind this prayer is that we have to trust in God and the way that He runs the world in order to fully heal from the loss of a loved one.
There are also several mentions of peace in the Mourner's Kaddish, which should not just be understood at face value. The word for peace in Hebrew is shalom, which is connected to the word shleimut, which means "wholeness". So we also ask God to grant us wholeness, despite the fact that we have just experienced a loss. And I think the way for us to get whole, according to this prayer, is trust in God and His greater plan.
All the best,