Michael Nahm, PhD, a biologist, studied a phenomenon called “terminal lucidity” in which a person who has been mentally disabled with dementia or other debilitating handicaps suddenly becomes lucid and aware, with no signs of the handicap, just before making the transition from this life. His article explains what he learned. His findings support the viewpoint that the mind and body are separate, so the mind is whole and healthy even when the body and brain are not functioning. The mind then returns to using the body just before the person’s passing.
This is a summary of cases reported in his article published in the Journal of Near-Death Studies. .
A Woman "Mad" for 20 Years Becomes Lucid Before Her Transition
Four weeks before her death, she finally recovered from her bad dream that had lasted for 20 years. But those who knew her before her madness hardly recognized her in her last state of transformation – so ennobled, enhanced, and elevated were all powers and sensations of her mental nature, so ennobled her articulation. She spoke with distinctness and inner brightness about things, which man learns only rarely to understand superficially in his ordinary state of being. Her story aroused furore. Literate and illiterate, educated and uneducated crowded at this dignified sickbed. All had to confess that even if she would have been taught by the most learned and enlightened men during the time of her illness, her mind could not have been more educated, her knowledge could not have been more substantial and higher than now, as she seemed to awaken from a long and deep confinement of all powers. 
A Mad, Violent Man Who Suffered from Memory Loss Became Lucid Just Before His Transition
Nahm cites a report by Andrew Marshal, who had published a number of cases of terminal lucidity in people with mental illness:
A mad and very violent ex-lieutenant of the Royal Navy, who also suffered from severe memory loss to the extent he did not even remember his own first name. On the day before his death, he became rational and asked for a clergyman. With him, the patient conversed attentively and expressed his hope that God would have mercy on his soul. An autopsy revealed that his cranium was filled with a straw-coloured water to a degree that it widened parts of the brain, whereas the brain matter itself and the origin of the nerves were uncommonly firm, the olfactory nerves displaying an almost fibrose appearance. 
A Man Living in an Asylum for Many Years from Mental Derangement Becomes Lucid Before Passing
G. W. Surya described an account of terminal lucidity he was given by a man whose brother had been living in an asylum for many years because of his serious mental derangement.
One day, Surya’s friend received a telegram from the director of the asylum saying that his brother wanted to speak to him. He immediately visited his brother and was astonished to find him in a perfectly normal mental state. On leaving again, the director of the asylum decently informed the visitor that his brother’s mental clarity is an almost certain sign of his approaching death. Indeed, the patient died within a short time. Subsequently, an autopsy of the brain was performed, to which Surya’s friend was allowed to attend. It revealed that the brain was entirely suppurated and that this condition must have been present for a long time. Surya asks: “With what, then, did this brainsick person think intelligibly again during the last days of his life?” 
A Woman Who Had Been an Imbecile for Eight Years Suddenly Becomes Lucid
In this report, a farmer’s wife who had a debilitating mental illness that had elements of being possessed by an alient suddenly became lucid before her passing.
Usually, the woman just stared in front of her; and – if at all – uttered only detestable swear words. When visited by the doctor or the priest, she displayed an odd virtuosity in successfully spitting on their shoes. One day, she began to converse rationally with her caretaker and apologized from deep within her heart for her bad behaviour. Broken and remorseful, she affirmed she was not able to behave in any other way since she had been forced to act like this. It was her utmost concern whether she would be forgiven for these and other sins. When the priest arrived, he handed her the requested Lord’s Supper. The next morning, she died in peace. 
A Man Who Lived for 14 Years in an Asylum Has Terminal Lucidity
One author cited by Nahm described two cases of terminal lucidity. In the first, a man had been in an asylum for 14 years with a remarkable mental illness. He became lucid just before his passing.
Georg lived for 14 years in Happich’s asylum. He arrived as a boy of six years and spoke only in ruptured curses. Confronted with the slightest obstacles, he bit himself and hit his head sore against walls and tables. It was hopeless to teach him even the easiest activities. For hours, he would sit on the same spot, rocking his body, talking to himself: “Eat soup, eat meat, eat vegetables, eat vegetables!” Later, caretakers discovered that Georg loved to sing songs and that he memorized them quite well. So, he learned many. Yet, it appeared as if he didn’t understand the meaning of them. Georg could not even tell the names of the carers who taught him the songs. Whenever asked for their names, he addressed the different carers by the names of the songs which they had taught him. One day, Georg fell sick with the flu and was transferred to the hospital of the asylum, which he already knew from numerous previous occasions. Yet, contrary to the former times, he instantly started to sing songs obviously related to dying. On his way to the hospital, he sang “Though I wandered through the dark valley, I do not fear any harm.” When laid down in a hospital bed, he sang all verses of the Christian dying song “O world, I have to leave you, I pass over my streets to the eternal fatherland.” On the next morning, his first words were “Georg goes to heaven today.” After a carer asked him to sing another song, he sang a song about a mill. As he reached the phrase “… and the millwheel didn’t turn anymore”, he shook hands with everybody present, said “Good night!” – and died. 
A Severely Mentally Disabled Woman Who Could Not Speak Becomes Lucid before Her Passing
One of the most disabled patients of Happich’s asylum was Kathe. From birth on, she was seriously retarded and never learned to speak a single word. She could only utter animal-like voices; her bodily abilities did not exceed uncontrolled spasms. It never seemed that she took notice of what was happening around her even for a second. One day, Happich was called to immediately visit Kathe by a physician and psychiatrist of the asylum, Dr. Wittweber. Kathe was ill with tuberculosis and she was about to die. When entering the room, Happich was stunned. He continues: “We did not believe our eyes and ears. Kathe, who never spoke one word, entirely mentally disabled from birth on, sang the dying songs to herself. Specifically, she sang ‘Where does the soul find its home, its peace? Peace, peace, heavenly peace!’ over and over again. For half an hour she sang. Then, she quietly died. Her face, up to then so stultified, was transfigured and spiritualized. Like myself and the present nurse, the physician had tears in his eyes. He stated repeatedly: ‘I cannot explain this in medical terms. If demanded, I can prove by autopsy that … from an anatomical perspective, thinking could not have been possible.’ ” 
A Mother Who Was Confused and Uttering Unintelligible Words Experienced Terminal Lucidity
A famous biologist and philosopher described what happened when his mother went unconscious just before her passing, but suddenly awoke and was lucid.
When we all expected that she would never wake up again and die in her sleep, something very strange happened: After having uttered only unintelligible words in the past hours, she suddenly awoke and became brightly aware, but at the same time she was very unwilling to find herself in life again! It had been so wonderful to be united with my father, her parents, and friends – all of whom were dead. In this respect one might be reminded of certain reports of Bozzano. The period of being awake did not last for long. Soon, my dear mother fell asleep once more, never to wake up again. 
 Michael Nahm, “Terminal Lucidity in People with Mental Illness and Other Mental Disability: An Overview and Implications for Possible Explanatory Models” from the Journal of Near-Death Studies, 28(2), Winter 2009.
 Gotthilf Heinrich Schubert, Die Symbolik des Traumes. Heidelberg, Germany: Lambert Schneider, 1968, p. 354, cited in Nahm, “Terminal Lucidity.
 Andrew Marshal. The morbid anatomy of the brain in mania and hydrophobia. London, England: Longman, 1815, p. 150.
 G. W. Surya, Der Tod kein Ende. Freiburg, Germany: Peter Hofmann, 1921, p. 14.
 Martensen-Larsen, An der Pforte des Todes. Berlin, Germany: Furche, ca. 1926, p. 128.
 P. Ringger, Die Mystik im Irrsinn. Neue Wissenschaft, 8, 1958, 217–219.
 Ringger, Die Mystik 219–220.
 H. Driesch, Lebenserinnerungen. Munchen, Germany and Basel, Switzerland: Ernst Reinhardt, 1951, p. 40.