Approximately 20% of all people have experienced a period of diagnosed mental illness at some point in their life as an adult, and among children it is nearly 50%. (
http://www.nimh.nih.gov/health/statistics/prevalence/any-mental-illness-ami-among-adults.shtml )
While it feels horrible and impossible, the fact is it is very common. 4 of the 10 most prescribed drugs in the world are for the treatment of mental illnesses. One of the things that makes mental illness feel so difficult is the perception that you are alone, nobody cares, or that nothing can help. The fact is it is incredibly common, more people than not have had it at some point in their life as an adult or child, and treatment works in over 80% of cases to either "dramatically reduce" or eliminate symptoms. Places like this website tend to obscure the fact that it is very treatable because we tend to accumulate more members that fall into that small category of people that do not respond as well as most to treatment.
If you eliminate alcohol and drug abuse or self medication, then success in treating mental illnesses like depression and anxiety tops over 95%. Basically, particularly with depression, no matter what one is taking for an anti depressant , it cannot make up for a daily dose of a strong depressant like alcohol as well. For anxiety, marijuana which has a side effect of causing paranoia and anxiety, renders most actual treatments useless.
The point? It sucks having depression , anxiety, or any any other mental illness but if you manage to push beyond the false perception that the mental illness causes it is very treatable and there is a way out of the darkness into a better life. It has nothing to do with "life situation" usually - getting girlfriends, boyfriends, different jobs, more friends ,or having a history of past abuse does not change the treatment and outcome. As soon as a person realizes they are treating an illness and treat it like an illness instead of believing that the life situation is to blame and cannot be helped, treatment is exponentially more effective (with anxiety and depression many find this the most important part of getting better- as well as the the most difficult- understanding it is a thing by itself and not the natural result of their life so they can focus their efforts in the right place).
Ii does not explain the why people have it , it does not make it fair. I have no comment about god or the universe. Just that it can and does get better for nearly all and the sooner it is treated correctly the faster it gets better (just like any other physical disease- the earlier treatment starts the more effective and shorter the course of treatment).