I've had platonic friendships with women almost all my life (I'm in my 60s).
Part of it, frankly, is that I just enjoy being around women more than men.
As for the flirtation angle, that has often come into play early on, but what I discovered is that even when the flirtation is mutual (and it has to be for it to be a genuine flirtation — otherwise it's a stalky, creepy thing), it often just means that there's a connection worth exploring.
How do we know the difference between whether that connection is romantic or just a friendship? I can't give an answer for that. It just sorts itself out organically somehow, in my experience.
It has helped me that women have a way of letting you know if they're interested in something beyond friendship. Shoving our lips into their face to offer them a kiss is no way to find out, and that's how too many guys try to see what's up.