There are so many different causes/triggers for mental illnesses. The most common are child abuse, trauma, neglect, social isolation, etc. Some people can get mental illnesses through genetics as well so they can do everything possible but they can’t prevent it from happening. Even bad or stressful environments can cause mental illnesses. There is no way for anybody to prevent getting a mental illnesses, although there are medications for some that can make it slightly less severe but it won’t completely go away. To control symptoms they can take steps to control stress, increase their resilience, and boost low self-esteem.
For depression, the four main causes are family history, illness and health issues, medication/drugs/and alcohol, and personality. Anxiety has several causes or triggers and it ranges from work stress or job change to death or loss of a loved one, most people develop anxiety from family and relationship problems, every kind of abuse, and major shock following a stressful or traumatic event. For schizophrenia, research suggests a combination of genetic, physical, psychological, and environmental can make someone more prone to getting the illness. The main cause of ADHD is genes you inherit from your parents.
Nobody can ever understand a mental illness unless they have gone through it themselves, most people think causes are much less severe than they really are.