First things first: Look presentable. For me, it’s just neat and hygienic. I’m not asking you to be in a $2000 suit nor be a certain height or build. Just like you’ve showered, brushed your teeth and have clean clothes on.

What to say: Anything with a point, some sensitivity, and sincerity. Like Erica Friedman said in her answer, do not presume. The following are rude and creepy catcalls and below my minimum standards of even looking at someone.
“Hey pretty, where you are goin’?” (What- so you can stalk and rape-murder me?) “Ni hao!” (culturally insensitive) “Hi, beautiful.” (no point) Or “Hey miss! You dropped your wallet!” (stupid, immature scam)

I also agree with Geoffrey Hamilton’s answer entirely, including the part where he says women have little authority on giving these kinds of advice. So here are just two examples of what worked with me, and I hope you can make something of use from them. 🙂

Examples of approaches from strange men I’ve found acceptable:

Someone once got my attention after I stepped off a train by saying “Hey, miss?” My default reaction is to ignore. He raised his voice a bit and said once more, “Hey miss?!” I turned around to see if it was directed at me, and he went on to tell me that he just couldn’t tell me how beautiful he thought I was and that I look very classy and lovely. Then he said, “I just wanted to let you know that.” I smiled, thanked him and told him that I was flattered, and meant it as I went along my way. He didn’t ask for my number, but I would have probably given it to him if he asked for it following the approach he had for his speech. Tacking on a “So, can I have your number?” makes it obvious it’s some statement he read off somewhere, like Quora, and was not his genuine words in the slightest bit. I imagine several men who are frustrated in the getting girl’s department are just frustrated by ladies who pick up on the bullshit they’re trying to pass on as an honor. Then some women are just bitches, too. But hey, there isn’t much you can do about that now, is there?

Another instance where I gave a guy my number was when I was just waiting for a light. He pulled out his phone and as he said the following held it with both his hands on his chest, “I’m so sorry, I don’t mean to harass you. But I think you’re adorable, and I would regret it if I didn’t at least try to ask for your number. Would you let me know what it is?” I smiled and said, “Okay, sure. Haha.” I typed my name in and never heard from him. Oh, wells.