Mental Health is as ambiguous as it is horrible to live with. 1 in 4 people worldly are affected by some form of mental illness ranging from depressive disorders, OCD, learning disorders, personality disroders, eating disorders, etc., meaning that you are very likely to encounter someone struggling with a mental health issue, whether they make it apparent to you or not.
Unfortunately, mental health awareness isn't enough to help those struggling with mental illness as friendship and support are what saves lives. Unfortunately, most people feel lost when trying to help a friend/partner/family member with mental illness. This is understandable since people and their experiences/condition/personality/situations differ and mental health is tricky in itself to control as the sufferer, let alone as an active bystander trying to help.
Don't Worry If You Don't Have Any Advice, No One Has The Answer to Mental Illness
There isn't an easy cure for mental illness, so there are times when you can't help in the way you'd want. There are days when your friend/family member is just feeling depressed/anxious for seemingly no reason and there isn't anything they, or you, can do to directly stop it.
In these cases, simply offering to help... can help. Ask them out for a movie, offer to visit them or for them to come to you, offer to go grocery shopping with them. Even if they say 'no', you are showing that you're there for them, which can mean more than any good advice can.
Be A Good Listener
Sometimes it's best not to say anything. People like to rant when they're upset, so it's good just to take a seat and let them ramble on about how their feeling. Give them the floor and let them speak.
Your Relationship With Them Is A No Judgement Zone
The most common thing people with depression/anxiety/bipolar/OCD/etc. fear is judgement and retaliation. If a friend comes to you looking for help it is because they want to trust you and by judging them for how they are feeling, not only are you breaking that trust but are making them feel worse about something they have little control over.
The weird logic going through other people's head may sound silly or irrational to someone who isn't suffering mental illness. However, if mental illness was a reasonable and rational condition, then it wouldn't even be called mental illness in the first place.
What Not To Say
Although it can be hard to know what to say, here is what definitely not to say...
"Just Get Over it," - if they could, they wouldn't feel this way.
"It's All in Your Head," - Yes... but that doesn't make how they feel any less relevant
"You Really Need To Calm Down" - again... if they could...
"Have A Drink to Take The Edge Off" - of water, that's great. Of alcohol, no, because in most cases it is what makes people worse.
"You don't look like you have ____" -...If you are referring to their looks, then you don't understand how mental illness works. If you are referring to their mannerisms, remember that people are really good at acting.
Overall, Just Be A Decent Friend
.... that's it.