The practice is based on revelations given to the prophet Joseph Smith on the subject, explaining how it should be carried out. The practice of baptism for the dead is not based directly on 1 Corinthians 15:29, since the biblical verse only alludes to the practice but explains nothing about the details of how it should be performed, but Latter-Day Saints use the verse as evidence that the practice did exist among early Christians.
The revelations explaining the practice are recorded today in various places, but the most important are found in sections 124 and 127 of the Doctrine and Covenants, where it's explained:
- that the ordinance belongs to the House of the Lord and is to be performed in temples
- that all baptisms must be witnessed and recorded to be valid
- that it must be performed by someone with Priesthood authority
- and that the practice is related to the concept of "that... whatsoever you bind on earth may be bound in heaven, [and] whatsoever you loose on earth may be loosed in heaven."
That's the basis of official LDS doctrine on the subject. With regards to non-doctrinal references, several LDS scholars have done a lot of research on the historical basis for baptism (and salvation in general) for the dead, and the findings are interesting: not only did the practice clearly exist, but it just as clearly deviates and fades in people's understanding over time.
In Paul's time, it was familiar and uncontroversial enough to his audience that he saw no need to explain the practice, and was able to use it as a supporting argument in favor of something that his audience did find controversial: the literal resurrection of the body. (See 1 Corinthians 15 for context.)
Tertullian, who lived a bit more than a century after Paul, knew about the practice:
But inasmuch as some are also baptized for the dead, we will see whether there be a good reason for this. Now it is certain that they adopted this (practice) with such a presumption as made them suppose that the vicarious baptism (in question) would be beneficial to the flesh of another in anticipation of the resurrection; for unless it were a bodily resurrection, there would be no pledge secured by this process of a corporeal baptism. Why are they then baptized for the dead, he asks, unless the bodies rise again which are thus baptized?
-- On the Resurrection of the Flesh, chapter 48
However, he did not seem to think that it should be interpreted literally, though he didn't really know what it did mean instead:
What, asks he, shall they do who are baptized for the dead, if the dead rise not? Now, never mind that practice, (whatever it may have been.) The Februarian lustrations will perhaps answer him (quite as well), by praying for the dead. Do not then suppose that the apostle here indicates some new god as the author and advocate of this (baptism for the dead. His only aim in alluding to it was) that he might all the more firmly insist upon the resurrection of the body, in proportion as they who were vainly baptized for the dead resorted to the practice from their belief of such a resurrection.
-- Against Marcion, book 5, chapter 10
The Marcionites, who Tertullian was writing against in the second quote, were a splinter group of Christians whose doctrine about the nature of God had gotten mixed with a bunch of weird Gnostic ideas. However, they seem to have preserved the doctrine of baptism for the dead intact to this point. A couple centuries later, however, we find John Chrysostom going after them and he brings up the practice again, which seems to have picked up a strange element of ritual along the way:
...will you that I should first mention how they who are infected with the Marcionite heresy pervert this expression? And I know indeed that I shall excite much laughter; nevertheless, even on this account most of all I will mention it that you may the more completely avoid this disease: viz., when any Catechumen departs among them, having concealed the living man under the couch of the dead, they approach the corpse and talk with him, and ask him if he wishes to receive baptism; then when he makes no answer, he that is concealed underneath says in his stead that of course he should wish to be baptized; and so they baptize him instead of the departed.
-- Homily 40 on First Corinthians
Note the introduction: Chrysostom is explicitly writing this in mockery of the Marcionites, (to "excite much laughter"), before an audience that is potentially unfamiliar with them and their beliefs. Human nature being what it is, it's possible that his description may have been exaggerated for greater effectiveness. Nevertheless, the example is instructive.
And in 393 AD, not long after Chrysostom, the synod of Hippo came out with a declaration which, among other things, expressly forbade performing the rites of baptism and the Lord's Supper for dead bodies, showing that by that time there were people around--and in large enough numbers to make it worth the notice of an official council--who still had some concept of the original idea, but had apparently lost the notion that it was supposed to be performed by proxy! Four years later, the Third Council of Carthage reaffirmed the earlier synod's ruling on the subject.
The progression shows that the doctrine was gradually lost over time without apostles receiving revelation from God to keep the church on track, and demonstrated why it was necessary for the doctrine to be restored in purity through revelation and not simply interpreted from sparse Biblical references through the wisdom of man.