As an institutionalized practice, Mormons don’t pray for the dead, although of course in their private worship many do–particularly for their own ancestors.
Mormons study their family history and try to find the names of ancestors who were non-Mormons. They will take those names to the temple and perform proxy ordinances such as baptism, endowments, and marriage rituals. Many Mormons who do their genealogy pray to find their ancestors’ names and that they will accept Mormonism in the hereafter so that they can become exalted.
The ritual of baptism for the dead is virtually identical to the ritual of baptism for the living: “Brother/Sister Last Name, by the power of the Aaronic Priesthood which I hold, I baptize you for and in behalf of First Name_ Last Name_, who is dead–in the name of the Father, and of the Son, and of the Holy Ghost. Amen.” (It’s been a while since I’ve done this, so my wording may be a bit off)
The dead all live in the spirit world, divided into two parts: Paradise and Spirit Prison. Paradise is for dead Mormons or people who have accepted Mormonism and had a proxy baptism performed for them in the temple. Spirit Prison is for those who have either rejected Mormonism, or who have accepted it but have not had their proxy ordinances performed yet.
Spirit Prison is somewhat similar in ways to Purgatory, but there are important distinctions.
At the end of the world, after the Millenium of Jesus’ reign on Earth, and the final spiritual battle between the people of God and Satan and his angels, is Judgment Day. This is the day when all will come to be judged according to their works and be assigned one of the three degrees of glory (heavens): Celestial, Terrestial, and Telestial. Apostates will be banished to Outer Darkness, along with Satan and his angels.
I have known some Mormons to pray to their dead ancestors (much like Catholics pray for the intercession of Saints) or who regard them as sort of “guardian angels,” but that is far from an orthodox position, so don’t quote me on this.