All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
A Muslim does not become a Kafir (non-Muslim) unless he says something, or acts in a way or believes in something, which the book or the Sunnah indicate as major Kufr, i.e. that takes the person out of the fold of Islam, or a thing on which there is a consensus among the Ulama (Muslim scholars) that it negates Islam.
These acts are as follows:
To insult Allah, or insult His religion, or one of His Prophets, may Allaah exalt their mention, to deny something which is known as part of necessary religion and that no one can deny.
To commit shirk (associating partners with Allah), like prostrating to other than Allah, to seek help from other than Allah in things that only Allah is capable of doing.
To slaughter in a name other than Allah's name.
To vow to other than Allah.
To support the Kuffars (non-Muslims) and help them against Muslims.
To doubt or deny resurrection; as well as other kinds of major Kufr that take the person out of the fold of Islam.
So if a sane, knowledgeable and pubescent person do any one of the above deliberately, he goes out of the fold of Islam. He has to repent to Allah and embrace Islam again.
The repentance for an apostate is to submit himself to Allah saying: "Ashhadu An-La Ilaaha Illa Allah, Wa Ashhadu Anna Muhammadan Rasoolu Allah." (I bear witness that none has the right to be worshipped but Allah and I bear witness that Muhammad is the messenger of Allah.)
Allah knows best.