Approaching a stranger
Getting someone's attention
"Excuse me?" (Make sure to use a friendly tone of voice, with rising tone at the end)
"Excuse me, sir?" or "Excuse me, ma'am?"
"Sorry to bother you, do you have a moment?" (Or, "do you have a minute?")
Asking for someone's name
if you've never seen them before:
"I'm sorry, I don't believe we've met. I'm ____." (Extend a hand for a handshake if appropriate.) "What's your name?"
if you've seen them but haven't talked:
"I've seen you around. I'm ______. What's your name?"
or, to observe a point of connection with them and ask for confirmation:
"You're in [so-and-so's class], right?"
"You live in [place], right? I've seen you around."
if you've met them but forget their name:
"I'm sorry, your name is escaping me."
"Sorry, can you remind me, what's your name?"
if you're asking their name after having talked for a while:
"What's your name, by the way? I don't believe we've met."
"What's your name, by the way? I'm _____.
Explaining what you want
If you're talking to a total stranger, do this soon. Get right to the point. People can get impatient quickly if they don't know why a stranger is talking to them.
"I'm doing a project for _____. We're supposed to _______. I was wondering, would you mind answering a few questions?"
Elegantly taking leave
"Well, I'd better get going. Thanks for your help!" (or, "Good talking to you!")
"I'm off to [place]. How about you?" … "Want to head over together?" (the subtext is, "do you want to keep talking?")