Assalamualaikum Warahmatullahi Wabarakatuh
In the name of Allah, the Entirely Merciful, the Especially Merciful. O Allah! I seek refuge in You from knowingly associating partners with You in any way, and I seek Your forgiveness for that which I do not know. Ameen.
When asking a Muslim about the conditions they want at the end of his life, they will definitely mention husnul khotimah. The meaning of husnul khotimah is a good ending, and the phrase husnul khotimah is often said when someone dies.
"O you who believe, fear Allah with true piety, and do not die unless you are a Muslim (surrender) ". (Surat Ali-Imran: 102).
Death in a state of husnul khotimah should be one of the dreams of Muslims. The meaning of husnul khotimah is the end of a person's life in good condition alias blessed by Allah s.w.t. Died in a state of husnul khotimah also has its own virtues. A person who dies in a state of husnul khotimah is considered to have signs that he died in good condition.
The word Husnul is taken from the word hasan, which means good. While Khotimah has the meaning of an end. So, the meaning of husnul khotimah is a good ending. The meaning of a good ending is death that ends in a good condition, aka the pleasure of Allah SWT.
A person who dies in a state of husnul khotimah has its own signs.
Say the shahada when you are about to die
From Mu'adz bin Jabal r.a., Prophet s.a.w. said,
"Whoever ends his words with the words 'laa ilaha illallah' (no god has the right to be worshiped but Allah), then he will enter heaven." (Narrated by Abu Dawud)
Died with sweaty forehead
From Buraidah bin Al-Hashib r.a., Rasulullah s.a.w. said,
"The death of a believer with sweat on the forehead." (Narrated by Tirmidhi, Ibn Majah, An-Nasa'i, and Ahmad)
Called a martyr other than a martyr on the battlefield
From Abu Hurairah r.a., Rasulullah s.a.w. said,
"There are five martyrs, namely those who died because of tho'un (plague), people who died from stomach pain, people who drowned, people who died because of falling debris and people who were martyred in the way of Allah." (Narrated by Bukhari and Muslim)
Died during childbirth, or while pregnant for women
From 'Ubadah bin Ash-Shamit r.a., that the Prophet Muhammad s.a.w. mentions several martyrs', among them,
"And the woman whose child is killed (for giving birth) is a martyr, and the child will pull her by the umbilical cord to heaven." (Mentioned by Shaykh Al-Albani in Ahkam Al-Janaiz, p. 53. He stated that this hadith is authentic)
Died while doing good deeds
From Hudzaifah ibn al Yaman r.a., Prophet s.a.w. said,
"Whoever says la ilaha illallah because he seeks the face of Allah and then his deeds are covered with it, he will enter heaven. Whoever fasts because he seeks the face of Allah and then ends his deeds with it, he will enter Paradise. Whoever gives charity then it becomes his last deed, then he will enter heaven." (Mentioned by Shaykh Al-Albani in Ahkam Al-Janaiz, p. 58. He said that this hadith is authentic).
Wallahualam.