Honestly, the reasons are likely to be as numerous as there are kinds of people with very different psychologies and behaviours.
However, setting aside neurodivergence and simply not being in any way someone anyone in their right mind would want to spend time with, and not making an effort, some of the fairly obvious things in common I see in regular posts on Mn about not having friends include:
only wanting 'friends' or 'a friend' or a 'girl group' as a generic category, to fill a gap in that person's life, rather than engaging with actual individuals eg 'I just want someone to come around for a cuppa/go the the cinema with' without any particular thought about who that person might be, or what might be the attraction)
being a people-pleaser who thinks you 'buy' friends with services. These people are often on here, bewildered, saying 'But I'm nice! I'll help anyone out! I listen to everyone and let them unload on me, and it's never reciprocated!' Failing to see that setting yourself up as a service provider just makes you an invisible dogsbody.
not thinking about what they bring to potential friendships, eg saying 'My life is so boring and dull, and I never step outside the house -- why don't I have any friends?' If you have nothing to talk about other than dusting your skirting boards, what do you bring to a potential friendship?
Basically, all of these come down to not thinking of other people as actual individuals that you like, and would like to be around more, just generic individuals needed to fill your gap. I doubt many people just want to be a generic 'friend' who is available for weekly offloads.