It's hard to help when you don't understand what they're dealing with. So do some homework on your friend's struggles.
If they have a diagnosed mental health condition (like depression or anorexia), find a book or some reputable websites that talk about those conditions.
Another option is organizations that provide support. To Write Love On Her Arms is a great organization that provides advice and encouragement for many common struggles.
Of course, your friend can educate you – they are the expert on their own struggle. They might not want to talk about their struggle, but usually people are happy to open up about how their problems affect them.
If you do talk to your friend about their struggles, remember to suspend judgement. It might not make sense to you why a breakup is so painful or why depression makes it so hard to get out of the bed in the morning. But your friend has no reason to lie to you, so if they're telling you something about their situation, it's probably accurate.
Again, your friend is the expert on their own struggle. Don't disagree with them about their experiences, or invalidate their feelings.
Instead, be a curious student. Ask questions and let them know you want to learn everything you can in order to help them better. The more you know, the more you can help.