If you're a close friend, and they feel like talking, ask them about the problem and what caused the mood.
If not, just be interested but not nosey.
Invite them for a coffee or make them one, and maybe talk about anything else which comes up.
Do not push for reason for mood. It will come out eventually.
Just be interested and receptive. Don't chatter on. Respect your friend's mood and emotions at the time.
Share a meal, a plate of cake or other "mood" food.
If you're in their house, maybe do the dishes while chatting. Go out in the garden or on the balcony. Get out of the "atmosphere" in the house/unit/apartment.
It the person is an acquaintance or work buddy go easy, but be interested. Don't intrude or invade their privacy. Just show interest.
Everything goes better if someone offers a sympathetic ear. Don't offer a "cure" or opinion unless its asked for. Just be there and be nice.