Simply put: 0 to 18. (I've never heard of anyone younger than 10 taking their life on purpose, so for the roughly 10 first years of a human life suicide seems to be a pretty moot concept.)
I've seen a few stand-up comedians summarize my general point of view: "If you're a destitute, childless and friendless person over 50, then why not kill yourself? Is there enough pleasure and meaning in this existence to give you any reason to linger on?"
I see a lot of young people on this forum complain about their toxic parents, etc. I take that "less seriously" than the complaints of those who are in chronic pain, in insurmountable debt, or middle-aged and friendless. If you're 18, for example, and your parents are narcissistic psychopaths, then move out. If that means sucking dick down by the docks in order to be able to pay for food, then that's at least a fresh and new hell. I have all the sympathy and understanding in the world for an 18-year old who faces those choices and crafts a noose. But, all else being equal, that 18-year old's potential for a life where the good shit is equal to, or bigger, than the bad shit is much greater than it is for a 48-year old.
According to current neuroscience, a person's brain isn't "fully developed" until about 25 years of age. At least, it isn't "crystallized" until that age - in its final form, so to speak. An average 5-year old will beat any adult genius in the world at truly learning a language, for example. Because that kid's brain is a mushy pile of whatever comes into it. The same 5-year old's brain will take in whatever bad shit that comes his way, and can be epigenetically triggered into becoming a psychopath - a socially broken person who will, necessarily, harm others, and for whom there is no chance of change and "redemption".
A large proportion of people on this forum either identify themselves as having, or display symptoms of, borderline personality disorder. Just like psychopathy, it is an epigenetically triggered personality disorder. For those people, as far as I know, there is no "hope". I get why they're here. They feel joy more intensely than "normals", but they also feel sorrow more intensely than "normals". And it's known that humans are DNA-wired to take pain and sorrow more to heart than joy. (We evolved from single celled organisms, and even for our closest relative - the chimpanzee - it's far more important to avoid pain than to achieve joy. Even "normal" humans are evolutionarily weighted to feel pain when it is caused, than to feel joy when it is caused.)
But, generally speaking, until you're 25, nobody - including oneself- knows who or what the fuck you are, and what your prospects in life are. But, if you are younger than 25, then you are probably reaching a conclusion that the evidence is yet to support.