How can a person kill himself if he is religious?
Same way as anyone else.
Having a religious belief does not mean that a person will act in accordance with that religious belief. This is not news, this has been known for literally many thousands of years.
A religion might proscribe adultery, yet an earnest believer in the religion might commit adultery. Same for theft, murder, etc. etc. etc. etc.
So a religious person can kill himself just like he can do any of the other things that his religion forbids. It doesn't mean that he doesn't believe in all of it, it just means that he couldn't resist.