Encourage: to give somebody support, courage or hope (Oxford Learners Dictionary)

When he heard that my father had passed away, he cancelled all his appointments and took the first available flight to be with me. My dad was in Penang. My friend was in the senior management of a major bank in Kuala Lumpur. Senior managers don’t have a lot of discretionary time, but he was my friend and he wanted to be with me to encourage me in a time of significant loss. This friend would come alongside me again and again in my life to encourage me by his presence, his wise words and material resources. He encouraged me by helping to bear my burdens. Honestly, I cannot see how my life would have turned out without the faithful care of my friend. This is the most basic expression of friendship — encouragement.
Citing the work of Aelred of Rievaulx, Paul J Wadell writes:

. . . life is often hard for us, more than any of us can handle alone. . . . No matter how blessed we may be, eventually we face times of adversity and hardship. We experience not only disappointments and setbacks but sometimes terrible losses from which we are not sure we will ever recover. . . . Sometimes we need to be rescued. Sometimes we need others to lean on, someone to take our hand and guide us along when our luck runs out, and this is what friends do for us. (Paul J. Wadell, Becoming Friends [Grand Rapids, MI: Brazos Press, 2002], 112–113.)

A few things need to be borne in mind when we seek to encourage a friend. Sometimes what we need to do, indeed sometimes the only thing we can do, is just to be with a friend in pain. Job’s friends got it right at first when they just sat quietly with him (Job 2:11–13). Some of us may feel that the way to encourage someone is to fix their problems. But sometimes we can’t. What we can do is weep with those who weep and rejoice with those who rejoice (Romans 12:15). We can give them our presence.
And even when it is time, and right, to say something, we must avoid platitudes and flattery. When Paul wanted to encourage the Christians at Thessalonica, he based his encouragement on God's truth (1 Thessalonians 4:13–18). We see Moses encouraging Joshua by pointing him to the Lord (Deuteronomy 31:7–8). Encouragers point hurting friends to the ultimate encourager, God Himself, by words and by their very presence. We see in Luke 24:36–49, when friends walk together, Christ walks with them.
Friendship and encouragement are linked because you can encourage someone to the degree you know their unfolding life story. It is hard for me to encourage you unless I know something of your pain and struggles. When Paul tells Timothy to take care of his tummy, Paul must have known him well enough to know of his stomach ailments (1 Timothy 5:23). This goes back to a basic commitment of friendship — the need to spend time with each other.
Sooner or later, we discover the reality of living in a fallen world. It is a world of much joy and beauty but it is also a world of much pain and brokenness. We are not meant to navigate this world alone. We need Christ and we need our friends.

Two are better than one,
    because they have a good return for their labor:
If either of them falls down,
    one can help the other up.
But pity anyone who falls
    and has no one to help them up.
Also, if two lie down together, they will keep warm.
    But how can one keep warm alone?
Though one may be overpowered,
    two can defend themselves.
A cord of three strands is not quickly broken.
(Ecclesiastes 4:9–12 NIV)