It's impolite to ask a stranger's ethnic origin, at least in the United States and Canada. Once you know someone quite well, you might be able to say something like There's something I've been wondering ever since we met. Would you mind very much if I asked your ethnic background? Many people with features which seem exotic for the area they live in get questions like this quite often. They may or may not react positively.
The worst way to phrase the question is What are you? The questioner has in mind "what's your ethnicity?" but the question is very offensive.