There is evidence for vicarious baptisms in the Bible. Paul speaks of it in 1 Corinthians 15. He uses the fact that vicarious baptisms were being performed to prove the resurrection. Verse 29 says, "Else what shall they do which are baptized for the dead, if the dead rise not at all? Why are they then baptized for the dead?" Basically, he says, "What's the point of vicarious baptisms if there is no resurrection?" I agree. There would be no point.
But why would we do such a thing? It all comes down to families.
Julie B. Beck said, "Without the family, there is no plan; there is no reason for mortal life." Teaching the Doctrine of the Family, Ensign, March 2011.
Heavenly Father has a plan for us and that plan centers on families. The whole point of us coming to earth is to live and learn in families to become like God and then ultimately live with our family again after we die. That's why the earth would be cursed if Elijah didn't turn the hearts of the fathers to the children and the children to the fathers (Malachi 4:5-6). The earth would be utterly wasted if families could not be together in the eternities (D&C 138:48).
In order for our families to be together with God we must make covenants and partake in ordinances. To enter the kingdom of heaven we have to be baptized (John 3:5). So in order for our families to be together with God, we must all be baptized.
There are several ordinances that we perform for the dead along with baptism. They are the same ordinances that members of the Church perform for themselves when they are alive. We only perform ordinances for the dead for people who did not have these ordinances when they were alive.
Most of the ordinances are individual, like baptism, but the last and most important ordinance seals families together for eternity. The sealing ordinance binds generations together and allows us to live with God as a family.
We do baptisms for the dead because we want to be with our ancestors after we die. We love them. We want them to be saved. We want to seal them to us so that we can be connected to them through God's power.
Family history work allows us to become connected to our ancestors through ordinances and through knowledge. You wouldn't think that finding a death record about someone would make you feel like you know them but it does! God could just reveal our entire genealogy to us if He wanted to, but I think working to find out more about our ancestors is important for us. It turns our hearts to them.