Give the person a clear cue they can hear. Glancing at your phone might mean you need to leave, or it might look like you’re checking a message. At a community meeting, try, “I’m glad you told me how the fundraiser went. I need to pick up my daughter, so I’m going to head out.”
If there’s something you genuinely want to continue, name it: “Could you text me the date of the next meeting?” If the conversation is complete, a simple “It was good seeing you” is enough. You don’t owe a promise to call or make plans.
Practice with a friend using a real reason you often need to leave. Search “polite ways to end a conversation” for wording that feels natural to you.