How to Help Someone With Their Grief
I'm glad that you are reading this in order to help someone else in their journey of grief. Helping your friends and loved ones with their grief is very important, and is often done very incorrectly. Most individual's main mistake is probably ignorance. Thank you for trying to be a helpful and good friend.
I know this may be frustrating because you want a clear answer, but helping another person with their grief does not have a defined solution. It varies from person to person, and may be difficult to understand what a person is actually in need of. Some people want to be left alone, while others want you to be sitting right next to them. At the same time, the person may not give clear signals as to what they want from their friends and family and may get upset at others for doing the wrong thing.
The first thing you need to do is not take anything too personally. Your friend or family member is probably very emotional and might take it out on you. Obviously that is no excuse to be a bad person, but for now, just continue to be understanding and empathetic, and to keep building your relationship.
The other thing that you need to do is just be there for them. Just be a shoulder for them to cry on, or an ear for them to talk to. For the most part, they probably don't want your advice, no offense. Just listen. You most likely don't understand what they are going through as everyone has different types of grief. At the beginning, I advise to just sit their with them (if they want you to); it could be in silence, with them crying, with both of you crying, or just them talking. But your main goal is to just make them feel loved. After a little bit, you can be with them and help them remember the person by looking at photo albums or doing what that loved one liked to do, but this option really depends on how your friend is feeling, so don't push anything onto them too quickly.
My only other advice is to please stop saying "I'm sorry for your loss." A few times is enough. I know you don't know what to say and that feels like a default answer, but there are so many other things you can say to help. You could say "I love you," "I'm here for you," "You can talk to me whenever you need to." I understand that sometimes it's okay to say it, but for some people -not all- it gets kind of annoying.
My most important advice is to just love them. That's all they need right now. I love you, and I hope you love and help them as well.