Good question because I just bought a Samsung Smart TV last night and when I tried to download the app from Google Play, it says the app is not compatible with my device, which just so happens to be Samsung's flagship mobile phone. Annoying.
Found it. It's called AllShare Control and it's awesome. While there is not a dedicated keyboard button, your phone's keyboard will pop up when you select a text field on the TV. Works great. There's a touch pad too.