Sum up the conversation
As The Muse states, if you want to finish a conversation, sum up the information you have exchanged, repeat what you have learnt, and thank the other person for taking the time to talk to you.
Give a specific reason for needing to leave
Do not give vague or empty reasons, such as "I have to go". Give concrete, specific reasons why you are unable to continue the conversation. If possible, be honest.
Suggest the next step
If you are interested in your partner in conversation, suggest the steps that could follow. Let them know that, unfortunately, at the given moment you do not have time, but suggest an event where you might see each other in the future, or propose a meeting sometime.
Introduce someone else
Another option is to "replace" yourself with someone else. Introduce a partner, friend or colleague, explain briefly what both of them do and let them continue to talk.
Do not offend
Never be rude to others and never insult anyone, even if the other person was boring you to death. You never know which contacts might one day be useful.
-mm-