Excellent question. The Hadith referenced in the question prohibits Muslims from النِّيَاحَةُ عَلَى الْمَيِّتِ = lamentation on the dead
. We may ask ourselves what people are called dead in Islam? Is Hussain ibn Ali among them?
1- Is Hussain ibn Ali الْمَيِّتِ = dead
?
What Allah says?
وَلَا تَحْسَبَنَّ الَّذِينَ قُتِلُوا فِي سَبِيلِ اللَّهِ أَمْوَاتًا بَلْ أَحْيَاءٌ عِنْدَ رَبِّهِمْ يُرْزَقُونَ - آل عمران 169
أَمْوَاتًا
is the plural form of الْمَيِّتِ
. So if someone is killed in the cause of Allah, considering him dead is not compatible with Quran.
2- Is Hussain killed in the cause of Allah?
What prophet Muhammad (PBUH) says about him? Among many Hadith provided for Hussain-ibn-Ali in Sunni books, a few are listed below:
قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " الْحَسَنُ وَالْحُسَيْنُ سَيِّدَا شَبَابِ أَهْلِ الْجَنَّةِ وَأَبُوهُمَا خَيْرٌ مِنْهُمَا "
The Messenger of Allah said: "Hasan and Husain will be the leaders of the youth of Paradise, and their father is better than them." Sunan ibn Majah, Vol. 1, Book 1, Hadith 118
And the other Hadith from prophet Muhammad (PBUH):
حَدَّثَنَا عَبْدُ اللهِ بْنُ صَالِحٍ، قَالَ: حَدَّثَنَا مُعَاوِيَةُ بْنُ صَالِحٍ، عَنْ رَاشِدِ بْنِ سَعْدٍ، عَنْ يَعْلَى بْنِ مُرَّةَ أَنَّهُ قَالَ: خَرَجْنَا مَعَ النَّبِيِّ صلى الله عليه وسلم، وَدُعِينَا إِلَى طَعَامٍ فَإِذَا حُسَيْنٌ يَلْعَبُ فِي الطَّرِيقِ، فَأَسْرَعَ النَّبِيُّ صلى الله عليه وسلم أَمَامَ الْقَوْمِ، ثُمَّ بَسَطَ يَدَيْهِ، فَجَعَلَ يَمُرُّ مَرَّةً هَا هُنَا وَمَرَّةً هَا هُنَا، يُضَاحِكُهُ حَتَّى أَخَذَهُ، فَجَعَلَ إِحْدَى يَدَيْهِ فِي ذَقْنِهِ وَالأُخْرَى فِي رَأْسِهِ، ثُمَّ اعْتَنَقَهُ فَقَبَّلَهُ، ثُمَّ قَالَ النَّبِيُّ صلى الله عليه وسلم: حُسَيْنٌ مِنِّي وَأَنَا مِنْهُ، أَحَبَّ اللَّهُ مَنْ أَحَبَّ الْحَسَنَ وَالْحُسَيْنَ، سَبِطَانِ مِنَ الأَسْبَاطِ.
Ya'la ibn Murra said, "We went out with the Prophet, may Allah bless him and grant him peace, and we were invited to eat. Husayn was playing in the road and the Prophet, may Allah bless him and grant him peace, raced the people and then spread out his arms. The boy began to run this way and that and the Prophet made him laugh until he caught hold of him. He put one of his hands under his chin and the other on his head and then embraced him. Then the Prophet, may Allah bless him and grant him peace, said, 'Husayn is from me and I am from Husayn. Allah loves anyone who loves al-Hasan and al-Husayn. They are two of my distinguished descendants.'" - Al-Adab Al-Mufrad 364 and also Sunan ibn Majah, Vol. 1, Book 1, Hadith 144
And what Hussain says himself about the reason of battle?
اني لم اخرج اشرا ولا بطرا ولا مفسدا ولا ظالما وانما خرجت لطلب الاصلاح في امة جدي، اريد ان آمر بالمعروف وانهى عن المنكر
I did not come out seeking to do evil, nor seeking to have fun, nor seeking corruption nor oppression. Rather, I came out seeking reform in the nation of my Grandfather. I want to enjoin what is right and forbid what is wrong.[Testament of Hussain ibn Ali to Muhammad ibn Hanafiyah] 5
And also from himself:
الا ترون الى الحق لا يعمل به والى الباطل لا يتناهى عنه، ليرغب المؤمن في لقاء الله، فاني لا ارى الموت الا سعادة، والحياة مع الظالمين الا برما
3- Is there any permission to cry because Hussain?
Sahid al-Bukhari, Book 23, Hadith 62 says prophet Muhammad (PBUH) cried after his son Ibrahim ibn Muhammad passed away.
The case for Hussain ibn Ali is also outstanding, because he is killed in the cause of Allah (and so Quran says he is Alive with his Lord). There are several book chapters of Hadith that offsprings of prophet Muhammad (PBUH) cried for Hussain, like this chapter of Bihar al Anwar.
4- What is the benefit?
We may ask ourselves: What is the benefit of lamenting and crying to the offspring of prophet Muhammad (PBUH)?
This is a good way to remember Hussain sacrificed himself and to prevent Yazid-ibn-Muawiya to change the direction of Islam from Sunnah of prophet Muhammad - PBUH. (See here a list of obsession's of Yazid-ibn-Muawyah army including firing Ka'ba and killing 10,000 Mulsims in Madina and indiscriminate rape of Muslim women, in addition to killing Hussain and his family).
Hussain trained us not to live with obsession and not to be quiet upon the falsehood, even if it costs our life. And this may be a reason that prophet Muhammad (PBUH) said: Husayn is from me and I am from Husayn.
5- Are all types of mourning people do correct?
For sure NO. Most of alive Shia scholars do not permit people to show their deep sorrow by severe injuries to the body, like swording head. Here is a fatwa by a Shia scholar, Sayed Ali Khamenei:
Any practice that causes bodily harm, or leads to defaming the faith, is Haram. Accordingly, the believers have to steer clear of it. There is no doubt that many of these practices besmirch the image of Ahlul Bayt's (a.s.) School of Thought which is the worst damage and loss.