Pure dumb luck.
I'm going through hell just as bad as the OP. I tried so hard I am losing my mind appetite sleep willing to live, but I still put myself out there and go to new places like the dumb jerk I am to prove all you wrong and still fail.
You're so focused on conventional friendships and relationships with others that you have long neglected your own issues. The kind probably best dealt with through a psychiatrist or neurologist. The sort of thing that's well above what any therapist or online forum can do for you.
To find peace you need to get help before you can approach others. Something you apparently haven't figured out yet.