damn. good question, just looked it up on yahoo answers: 
I'll use "你好吗" (how are you) as an example. In hanyu pinyin, it's "nǐ hǎo ma". So you just have to type "ni" and select 你 out of all the other words similarly pronounced as "ni". Repeat for 好 and 吗. 
confusing-yes.