When you first run RetroPie it should ask to configure the controls,and based on the configuration entered, will generate input configurations for RetroArch based emulators and Emulation Station. As mentioned other emulators will need to be configured separately. On my original Kickstarter Picade the mapping is fine for mame4all, but if running a Pi2, you probably should switch to
As one of the main RetroPie devs and a Picade owner, it should work out of the box on the Picade - so on first boot, you should be able to hold a button down and it should say "keyboard" and ask for inputs to be configured. If your buttons don't work at this point, then there may be an issue with your setup.
To help in more detail I will need more information. Are you using a fresh image of RetroPie 3.1 for example ? How are you powering your Pi ? When you first boot, which buttons/controls don't work. If you plug in an external keyboard and drop to a terminal (f4 from within ES then press a key to stop ES restarting), and run "showkey --scancodes" do you get output for all controls ?