A good answer to this question requires a brief explanation of the literal meaning of the following words: qadha (decree), qadar (destiny), taqdir (predestination/determination), and taqdire-elahi (divine determination).
“Qadar” literally means size, “taqdir” means measurement and the definition of “qadha’” is execution and completion. But in technical terms, taqdire-elahi (divine determination) is used for Allah’s determination regarding the limits and boundaries of different phenomena and all of the traits and characteristics of His creatures that all have their own specific cause in this world. The concept of Qazaye-elahi (Gods decree) refers to the completion and creation of creatures at the final stage. In other words, when all material conditions for the taking place of a phenomenon are met, He is the one who “verifies” it and allows it to take place, and to put it simply, “finishes the job”. Of course, it should be noted that when it comes to our actions, [which are part of the different phenomena this world consists of], Allah’s (swt) divine decree covers them with all of their causes and characteristics, one of those causes being our choice and free will. So what Allah (swt) allows to take place when it comes to our actions, is what we have chosen to do. Therefore, considering the fact that the attribute of free will is a part of what He determines as a whole, there is no contradiction whatsoever between attempting suicide and decree and destiny.
However such a person’s position in the hereafter depends on the conditions of how he committed suicide. For example if his type of attempt was a type of attempt that would usually and most likely end in his death, it would be considered suicide and according to the traditions would have a severe punishment. On the other hand, if what he did was something that usually doesn’t lead to death, yet he died of it, he won't have such a punishment and if he is to be punished, it will be much less.
In order to answer this question, a few points need to be mentioned:
1- The concept of “qadha” and “qadar”:
The word "qadar" means size, and "taqdir" means measurement and making something with a specific size. The word "qadha" means to finish off or to give a final of verdict on an issue or execute something. These two words are sometimes used interchangeably for the meaning of destiny and fate.
What “taqdir elahi” means is that God has predetermined a particular quantitative, qualitative, temporal and spatial character for each and every creature which all occur under the influence of gradual causes. Qadha elahi means that after all the factors, causes and necessary conditions of one creature have been brought together and met, God projects it to the last and final stage which is simply for it to take place. So when different things take place in this world, it is Allah (swt) who is making that happen, but as was said, all other conditions [except for the taking place part] have to have been met beforehand.
2- The relationship between decree, destiny and man's free will:
There are two types of divine decree (fate):
a) The type that is out of man’s control; like floods, earthquakes, hurricane and the like in which in such cases a true believer should be in total surrender and submission to Allah’s (swt) will and be happy with what He has determined for him. Of course, there is no contradiction between being in total surrender to divine will and trying to prevent these phenomena or lessen the casualties and damage done by them or undo their damage afterwards. The reason for that being that surrender and submission have to do with the phenomenon itself, which had nothing to do with our free will, while what we are responsible for and have to strive for, are to prevent the phenomenon from taking place, to lessen its destructiveness, and undo the damage it has done afterwards; all of these being actions that have to do with our free will. These two [what has nothing to do with our free will and what we have been ordered to strive for] are two different concepts, because there are always still chances of the failure of what we have strived for and the phenomenon still taking place with full force and destructiveness. For instance, a person can try his best to build a building that can stand up to the strength of a certain earthquake, but if an earthquake stronger than what he had predicted takes place, ruining the building, he will be happy and submitted to Allah (swt) regarding what has happened if he is a true believer.
b) The second type of fate is the one which covers actions that we decide to do willingly. Here, there is no contradiction between divine decree and our choice and free will and that is why we are responsible for the outcomes of our actions, because what is meant by divine decree here is that each and every phenomenon to take place, along with all of its characteristics is subject to Allah’s (swt) knowledge. What Allah (swt) “finishes off” is what we have decided to do along with all of the causes and characteristics needed for it in this material world. Some of these causes have to do with time and place, others have to do with us; one of them being that it has to have been out of choice and free will. Therefore, what is meant when it is said that Allah (swt) “verifies” and “signs” our actions beforehand, is that we do things in certain places at certain times along with free will.
3- The ruling on committing suicide
Suicide is one of the great sins Allah (swt) has prohibited. Imam Sadiq (as) has been narrated saying: “Whosoever commits suicide will remain in the Hellfire forever.” Also, Imam Baqir (as) has said: “All catastrophes and any form of death is possible for the true believer [showing that the true believer is like everyone else in being subject to any of these], but he never commits suicide.”
So, if anyone ever commits suicide for any reason, he has committed a great sin and will be punished severely on the Day of Judgment.
4- The ruling on the person who threatens to commit suicide, without the true intention of doing so:
First of all, even pretending to commit suicide (even if it doesn’t lead to death) is also forbidden in Islam, because it is a form of resembling those who sin and is considered disregard for Allah’s (swt) boundaries.
Secondly, if it does actually lead to death, it depends on what the person had done to show he was committing suicide. If what he was doing is something that is fatal and usually leads to death, such as diving from the fourth floor of a building, it doesn’t make a difference if the suicide was intentional or not.
But if what he/she had done is something that isn't so, and the individual had no true intention of committing suicide, it isn't considered suicide anymore, although the person has sinned in pretending to commit suicide as was said earlier, yet he/she will not punished as a person who has actually committed suicide.
As for your question about the person’s death being a fate determined by Allah (swt) or not, it can be easily answered by the explanations we had above; there is no contradiction between our free will and Allah’s (swt) decree and determination. It doesn’t make a difference whether the dead person had actually intended to commit suicide or not; Allah’s (swt) decree can be found in both cases [of course with the meaning that we explained for Allah’s (swt) decree]. Nevertheless, the outcomes of different actions and events in this life and the next differ. Otherworldly outcomes depend on how much the action or event has to do with us and our free will and decision; when there was no intention of committing suicide, and the method used wasn’t a fatal one, naturally the otherworldly outcomes will also be much less.