It takes practice, but a good approach is not to go beyond a few sentences on a topic at a time. Give them a chance to change the direction of the conversation (which will happen if they are not interested) or ask follow-up questions (typically indicates that they are interested, although sometimes it may just be that they are being polite, in which case you’ll usually only get one or two before the other person moves on to something else). As one of the other comments says, it’s a dialogue, not a monologue - most of the time the other person isn’t engaging to get information from you but to connect with you (and yeah, that can be a really nebulous concept at times!). It’s really easy to infodump but most people don’t have the context or depth of knowledge to follow a deep dive on a subject.
The best case is when I am (1) well-rested, (2) not hungry or thirsty and (3) not already agitated/close to being overwhelmed going into it. Socialising definitely drains me, though, and I have gotten better at recognising when I need a break before it becomes critical. That way I can politely excuse myself (if it’s a social function, usually I have a plan in advance to go outside or away from people for a bit to recover).
Unfortunately it’s just reality that some people are energised by that type of conversation or social interaction, whilst for others it is exhausting. Energy management is the key thing for those of us who find it draining. Interoception is sometimes impeded for individuals on the spectrum, so if it’s hard to identify or keep track of how are you going (and hence whether it is time to politely exit the conversation), there are exercises one can find online to help improve interoception.