In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear questioner! Thank you very much for this question that reflects deep insight and true search for knowledge. May Allah grant you success in this life and the Hereafter.
It goes without saying that, leaving Islam is the ugliest and the worst form of disbelief (kufr) in Almighty Allah. It is technically called ridda (apostasy from Islam), and someone who leaves Islam is called a murtadd (apostate).
The Qur'an makes it clear that the one who leaves Islam, hinders people from the path of Allah and then dies as such will be a loser on the Day of Judgment. His eternal abode will be Hell, where he/she will suffer severe torture and endless chastisement. Allah will not forgive him/her, nor will any of his/her good deeds be accepted from him/her. Allah Almighty says: (Lo! Those who disbelieve and turn from the way of Allah and then die disbelievers, Allah surely will not pardon them.) (Muhammad 47: 34)
Also, the Prophet (peace and blessings be upon him) is reported to have said: "The blood of a Muslim who testifies that there is no god but Allah and that I am the Messenger of Allah is not lawful to shed unless he be one of three: a married adulterer, someone killed in retaliation for killing another, or someone who abandons his religion and the Muslim community.''
The prescribed punishment for a murtadd:
If a sane person who has reached puberty voluntarily apostatizes from Islam, he deserves to be punished.ž In such a case, it is obligatory for the caliph (or his representative) to ask him to repent and return to Islam. If he does, it is accepted from him, but if he refuses, he is immediately killed.ž
No one besides the caliph or his representative may kill the apostate. If someone else kills him, the killer is disciplined (for arrogating the caliph's prerogative and encroaching upon his rights, as this is one of his duties).
There is no blood money for killing an apostate (or any expiation). If he apostatizes from Islam and returns several times, his return to Islam, which occurs when he states the two Testifications of Faith, is accepted from him, although he is disciplined.
If a spouse in a consummated marriage apostatizes from Islam, the couple are separated for a waiting period (`iddah) consisting of three intervals between menstrual cycles. If the spouse returns to Islam before the waiting period ends, the marriage is not annulled but is considered to have continued the whole time.
(Based on 'The Reliance of the Traveler, by Ahmad Ibn Naqib Al-Misri, with some amendments.)
In addressing the issue of apostasy it is important to keep in mind the time, circumstances and the conditions that existed at the time of a particular ruling or judgment. Most modern governments do not apply Shari`ah law. However, this does not justify individuals taking it upon themselves to kill people if they apostatize from Islam. If this were to happen, such reckless action would only lead to a vicious circle of murder and homicide in which case a great deal of innocent people would be injured. As it stands presently, the means for dealing with apostasy are appropriate. Muslims should know that Almighty Allah has promised the apostate a severe punishment in this life, and an even greater punishment in the next life.