Rabbi Manis Friedman gave in a video a single sentence that has served me well for years. The rule is often simply stated as, don't talk to girls. He said,
"Don't talk to women any more than necessary."
How does this play out? Female coworkers, I talk only briefly about work only. I almost never initiate conversation, and let it end quickly. Female friends I've had since (secular) high school? Well surprise, they never reach out. Those that have, it's been once per 1-3 years. Years. And I don't initiate. Turns out, any female friend you have is likely not as close as you thought. If she is, talk to a matchmaker, it's a sign! Haha.
In other words, you don't have to be rude, in fact apparently they seem to like me more than other men even though we barely talk. Don't shut conversation down, but don't extend it either. Also, I make sure never to be alone in a room (say, the eating alone in the lunch room at work, and someone walks in) for more than a few seconds. Being aware of the more specific modesty laws like yichud, gives one a sensitivity worth having. Even though the door is wide open, finishing or leaving with my sandwich is between me and Hashem, and therefore I can move along genuinely and politely.
Maybe that's it. It's not about women. It's about sensitivity. Be polite, to women and to Hashem. And on mixed events, well, I tend to keep my eyes on the sky, and away from people in general. I went to a carnival a few years ago l to get overpriced popcorn and lose some carnival games, and it was okay. I don't seek such things. I also go to museums sometimes. Looking up makes you seem distant and perhaps thoughtful. That is, far too busy with your thoughts to draw any woman's attention.