To understand the doctrine of baptism for the dead, it's necessary to first understand the doctrine of baptism, and the crucial role it plays in LDS theology. Baptism is held to be essential for the salvation of everyone with the maturity to be capable of committing sin. The fourth Article of Faith states:
4 We believe that the first principles and ordinances of the Gospel are: first, Faith in the Lord Jesus Christ; second, Repentance; third, Baptism by immersion for the remission of sins; fourth, Laying on of hands for the gift of the Holy Ghost.
This is consistent with Acts chapter 2, in which, after hearing the Apostles' miraculous teachings:
37 Now when they heard this, they were pricked in their heart, and
said unto Peter and to the rest of the apostles, Men and brethren,
what shall we do?
38 Then Peter said unto them, Repent, and be baptized every one of you
in the name of Jesus Christ for the remission of sins, and ye shall
receive the gift of the Holy Ghost.
The same principle is found in Acts 19:
1 And it came to pass, that, while Apollos was at Corinth, Paul
having passed through the upper coasts came to Ephesus: and finding
2 He said unto them, Have ye received the Holy Ghost since ye
believed? And they said unto him, We have not so much as heard whether
there be any Holy Ghost.
3 And he said unto them, Unto what then were ye baptized? And they
said, Unto John's baptism.
4 Then said Paul, John verily baptized with the baptism of repentance,
saying unto the people, that they should believe on him which should
come after him, that is, on Christ Jesus.
5 When they heard this, they were baptized in the name of the Lord
6 And when Paul had laid his hands upon them, the Holy Ghost came on
them; and they spake with tongues, and prophesied.
7 And all the men were about twelve.
This poses a problem, though: if God wishes to have all men be saved and come to a knowledge of him (1 Timothy 2:3-4), and the principles of salvation require all to be baptized and receive the Holy Ghost by the laying on of hands, then what of those who are incapable of meeting this requirement because they are no longer in possession of a physical body? There have been many people who lived their entire lives and died without ever so much as hearing about Jesus Christ, because of where they lived. Is it consistent with the idea of a loving God to place His children in such circumstances and then condemn them for it?
The doctrine of baptism for the dead by proxy (and also of the laying on of hands to confer the gift of the Holy Ghost, by proxy, which is part of the same process) is the resolution to this problem. It allows Latter-Day Saints who can obtain proof that a certain person existed, and that they lived and died without receiving the benefits of the Gospel, to receive the ordinances of salvation on their behalf, by proxy.
The doctrine is that this allows (but does not compel) the departed to accept the work that has been done for them, and progress in their understanding of Gospel principles, which are being taught to them (1 Peter 4:6), that they might gain salvation alongside those who were able to accept the Gospel in the flesh.
So in response to the question above, these ordinances are not performed for people who were Mormon, but for people who lived and died without accepting the restored Gospel. With regard to point #5, I'm not sure what the doctrine is on performing proxy work on behalf of people who chose to leave the church. If anyone does know, feel free to edit it in here, with a citation.