Al-barzakh is the period between a person's death and his resurrection on the Day of Resurrection. Whoever dies as a Muslim, obeying Allah, will be in a blessed state, and whoever dies as a kaafir, disobeying Allah, will be punished.
Man’s life is divided into three sections:
1 – The life of this world, which ends with death.
2 – The life in al-barzakh, which starts after death and ends when the Hour begins.
3 – The life of the Hereafter, which begins after the people are raised from their graves, and is spent either in Paradise (we ask Allah of His Bounty) or in Hell (we seek refuge with Allah). So the life of al-barzakh lasts from after a person dies until he is resurrected. 
Linguistically, “Barzakh” means a veil, barrier or partition between two things. Ibn Abbas (radhi allahu anhu) defines Barzakh as, a Hijab (a partition of veil). Adh-Dhahhak (a Tab’ieen scholar of Tafseer) says: ‘Barzakh is the stage between this world and the Hereafter. Al-Qurtubi, in his exposition on these various interpretations states: ‘The Barzakh is a barrier between two things. It is the stage between this world and the other world - from the time of death until the time of Resurrection. Thus, whoever dies enters the Barzakh”
In shari’ah, barzakh refers to the period from death until the Resurrection. Allah (the Mighty and Majestic) says:...And behind them is barzakh (a barrier) until the Day when they will be resurrected. (Qur’an Surah Mominoon 23: 100) 
Allah says: The Fire, they are exposed to it morning and evening. And the Day the Hour appears [it will be said], "Make the people of Pharaoh enter the severest punishment." [Qur’an Surah Ghaafir 40:46] 
A hadeeth was narrated in Saheeh al-Bukhaari which describes the torments of al-barzakh which will befall some of those who committed major sins. It was narrated that Samurah ibn Jundub (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings of Allaah be upon him) often used to ask his companions, ‘Did any one of you see a dream?’ So dreams would be described to him by those who Allah willed should speak. One morning, the Prophet (peace and blessings of Allaah be upon him) said:
“Last night, two people came to me (in a dream), and woke me up and said, ‘Let’s go!’ I set out with them, and we came across a man who was lying down, with another man standing over him, holding a big rock. He threw the rock at the man's head, smashing it. The rock rolled away, and the one who had thrown it followed it, and picked it up. By the time he came back to the man, his head had been restored to its former state. Then he (the one who had thrown the rock) did the same as he had done before. I said to my two companions, ‘Subhaan Allaah! Who are these two persons?’ They said, ‘Move on!’ So we went on, and came to a man who was lying flat on his back, with another man standing over him, holding an iron hook. He put the hook in the man's mouth and tore off that side of his face to the back (of his neck), and he tore his nose and his eye from front to back in a similar manner. Then he turned to the other side of the man's face and did likewise. No sooner had he finished the second side but the first side was restored to its former state, then he went back and did the same thing again. I said to my two companions, ‘Subhaan Allaah! Who are these two persons?’ They said, ‘Move on!’ So we went on, and came to something like a tannoor (a kind of oven, lined with clay, usually used for baking bread). – I think the Prophet (peace and blessings of Allaah be upon him) said, in that oven there was much noise and voices. The Prophet (peace and blessings of Allaah be upon him) added: - We looked into it and saw naked men and women. A flame of fire was reaching them from underneath, and when it reached them, they cried out loudly. I asked them, ‘Who are these?’ They said to me, ‘Move on!’ So we went on and came to a river – I think he said, red like blood. – In the river there was a man swimming, and on the bank there was a man who had gathered many stones. Whilst the swimmer was swimming, the man who had gathered the stones approached him. The swimmer opened his mouth and the man on the bank threw a stone into it, then the swimmer carried on swimming. Each time he came back, he opened his mouth again, and the man on the bank threw another stone into his mouth. I said to my two companions, ‘Who are these two persons?’ They said, ‘Move on, move on!’ We went on and came to a man who had the most repulsive appearance imaginable. Beside him there was a fire, which he was kindling, and he was running around it. I asked my companions, ‘Who is this man?’ They said, ‘Move on, move on!’ So we went on until we reached a garden of deep green dense vegetation, with all kinds of spring colours. In the midst of this garden was a very tall man, whose head I could hardly see because of his great height. Around him there were children, a great number such as I have never seen. I said to my companions, ‘who is this man, and who are these children?’ They said, ‘Move on, move on!’ So we went on, until we came to a huge garden, bigger and better than any I have ever seen. My two companions said to me, ‘Go up.’ So we went up into it, until we reached a city built of gold and silver bricks. We went to the gate and asked for it to be opened. It was opened and we entered the city, where we found men with one side of their bodies more handsome than the most handsome person you have ever seen, and the other side uglier than the ugliest person you have ever seen. My two companions ordered those men to throw themselves into the river. There was a river flowing through the city, and its water was pure white. The men went and threw themselves in the river, and came out with the ugliness in their bodies gone, and they were in the best shape. (My two companions) said to me, ‘This is the Paradise of ‘Aden (the Garden of Eden), and that is your place.’ I looked up and saw a palace like a white cloud. They said to me, ‘That is your place.’ I said to them, ‘May Allah bless you both, let me enter it.’ They said, ‘For now you will not enter it, but you shall enter it (one day).’ I said to them, I have seen many wonders this night. What do all these things mean that I have seen?’ They said: ‘We will tell you. The first man you came across, whose head was being smashed with the rock, is the man who studies the Qur’an then he neither recites it nor acts upon it, and he goes to sleep, neglecting the obligatory prayers. The man you came across whose mouth, nose and ears were being torn from front to back, is the man who goes out of his house in the morning and tells a lie that is so serious that it spreads all over the world. The naked men and women whom you saw in a structure that resembled an oven are the adulterers and adulteresses. The man you saw swimming in the river with rocks being thrown into his mouth is the one who consumed riba (usury). The ugly-looking man whom you saw kindling a fire and walking around it was Maalik, the keeper of Hell. The tall man whom you saw in the garden was Ibraaheem, and the children around him were the children who died (young) in a state of fitrah (natural state of mankind, i.e., Islam).’ – Some of the Muslims asked, ‘O Messenger of Allaah, what about the children of the mushrikeen?’ He said, ‘And the children of the mushrikeen too.’ – ‘As for the men who were half handsome and half ugly, they were people who had mixed a good deed with another deed that was bad, but Allah forgave them.’” (narrated by Muslim, no. 6525) 
When a person dies, the Angel of Death and his helpers take the soul from the body of the deceased. The soul leaves the body from the mouth. As it travels through the throat, the dying person will hear a rattling sound as the soul makes its exit. The person’s eyesight will then fixedly stare at the soul as it ascends with the angels. This event is mentioned in the following Hadith : Narrated Abu Hurayrah (may Allah be pleased with him):
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) mentioned ten things which will bring about expiation, one of which is the torment in the grave. He said, “Whatever befalls the believer in this world, in Al-Barzakh and during the Day of Resurrection of pain which is a torment, Allah will cause that to expiate for his sins. It was reported in al-Saheehayn that the Prophet (peace and blessings of Allah be upon him) said, ‘Nothing befalls the Believer of disease, affliction, grief or harm, even a thorn which pricks him, but Allah will cause it to expiate for his sins’” [Majmoo’ al-Fataawaa, 24/375].
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him and save him from the torment of the grave) said:
If a person is a kaafir (we seek refuge with Allah), then there is no way that the delight will ever reach him, and his torment will be continuous. If a person was a sinner but he was a believer, then his torment in the grave will be commensurate with his sin, and perhaps the punishment for his sin will take less time than the time in al-barzakh between his death and the onset of the Hour, in which case it will cease. (al-Sharh al-Mumti’, vol. 3, p. 253)