Loneliness is caused by many things but at one point or another it is a struggle for most people I believe. Things like friendships take time, circumstances can be confusing, or feelings unknown/ uncertain.
I believe God gives it to us as a gift like so many other trying things he test us and calls us to embrace him. Where do we go at the first thought of this. In public I retreat to the safety of mind, which isn't really that safe after all as it wanders, but in private I retreat to his words. He loves me, he is with me always, he accepts me as I am and deems me as worthy. These are the truths. Not what my mind wants to tell me like no one cares about you, you are alone (really, I'm sure 90% of the time there is at least one person who feels as ackward as I do!) you are not worthy.
Last year I began to memorize scripture and this helps me to combat the lies the world tells me and my sinful nature conjures. No this life is not easy and sometimes it is lonely but I've learned we have a faithful and loyal God and I want to carry those characteristics. I'll leave you with one of my favorite poems by Ella Wheeler Wilcox entitled "Solitude"