Can We Offer Janazah for Someone Who Commits Suicide?
Question

Is it permissible to offer the funeral prayer for one who committed suicide?
Praise be to Allah.Suicide in Islam
Killing oneself is a major sin, and there are stern warnings addressed to the one who does that, but it does not put one beyond the pale of Islam.
In the Sunnah, it shows that it is permissible for ordinary people to offer the funeral prayer for one who commits suicide, but it is prescribed for the elite, such as scholars and prominent figures, not to offer the funeral prayer for him, as a rebuke and so as to deter others from doing likewise.
It was narrated that Jabir ibn Samurah (may Allah be  pleased with him) said: A man who had killed himself with a broad, sharp-edged arrow was brought to the Messenger of Allah (peace and blessings of Allah be upon him) and he did not offer the funeral prayer for him. (Narrated by Muslim, 978)
An-Nawawi (may Allah have mercy on him) said:
The scholars said: this Hadith is to be understood as a deterrent to suicide, just as he did not offer the funeral prayer for one who was in debt, but the Companions offered the funeral prayer for the debtor on the command of the Prophet (peace and blessings of Allah be upon him).
That was in order to deter others from getting into debt, not because he was a disbeliever. According to Imam Malik, it is disliked to offer the funeral prayer for one who has been stoned to death as a punishment, and one who was immoral, as an expression of disapproval. (End quote from Sharh Muslim, 7/47)
Shaykh Al-Islam Ibn Taymiyah (may Allah have mercy on him) was asked about a man who claimed to be a holy man, then he saw a snake and some of the people wanted to kill it, but he stopped them, then he picked up the snake trying to do a miraculous deed, but the snake bit him and he died. Is it permissible to offer the funeral prayer for him or not?
He replied:
Praise be to Allah, the Lord of the Worlds. The scholars and people who are religiously committed should not pray for this man and others like him, but the ordinary people should pray for him, just as the Prophet (peace and blessings of Allah be upon him) refrained from praying for a man who had committed suicide, and one who had stolen from the war-booty, but he said: “Pray for your companion.” They said to Samurah ibn Jundub: “Your son did not sleep last night.” He said, “Was it because he ate too much?” They said: “Yes.” He said: “If he had died I would not have prayed for him.” Samurah explained that if he died because he had eaten too much, he would not pray for him, because he would have killed himself by eating too much. And it is more appropriate that the scholars and those who are religiously-committed should refrain from offering the funeral prayer for this man who prevented others from killing the snake, and held it in his hand until it killed him, because he killed himself. (End quote from Al-Fatawa Al-Kubra, 3/20, 21)
Shaykh Al-Islam (may Allah have mercy on him also said:
If a person refrains from praying for one of them – i.e., the one who stole from the war-booty, the one who killed himself and the debtor – as a deterrent to others from doing likewise, then that is good.  But if he refrains from praying for him in public but makes Du’a’ for him in private, then he will achieve two ends, which is better than omitting one of them. (End quote from Al-Ikhtiyarat Al-`Ilmiyyah, p. 52)
Shaykh `Abd Al-`Aziz ibn Baz (may Allah have mercy on him was asked:
Can the funeral prayer be offered for one who kills himself?
He replied:
Some of the Muslims should pray for him, as for any other sinner, because he is still a Muslim according to Ahl As-Sunnah. (End quote from Majmu` Fatawa Ash-Shaykh Ibn Baz, 13/162)
And he was asked:
Should one who killed himself be washed and the funeral prayer offered for him?
He replied:
The one who killed himself should be washed and the funeral prayer offered for him, and he should be buried with the Muslims, because he is a sinner, but he is not a disbeliever; killing oneself is a sin, it is not an act of disbelief.
If a person kills himself – Allah forbid – he should be washed and shrouded, and the funeral prayer offered for him, but the ruler and important figures should refrain from offering the funeral prayer for him as an act of denunciation, lest anyone think that they approve of what he did. If the caliph, ruler, judges, governor, mayor etc., do not offer the funeral prayer for him as an act of denunciation and a declaration that this was wrong, then that is a good thing, but some of the worshippers should offer the prayer for him. (End quote from Majmu` Fatawa Ash-Shaykh Ibn Baz, 13/122; Fatawa Islamiyyah, 2/62)
And Allah knows best.