How do I set up KODI (OpenELEC) for any remote to control the media player, on the Raspberry Pi 2?
The simplest method is to use HDMI-CEC. You need a half decent HDMI cable (I've used some that didn't work) and a CEC enabled TV. This has different names under different manufacturers (see here for details). OpenELEC should have the feature enabled by default.
It should be as simple as just plugging in the pi and enabling CEC on the TV. After that the commands from your TV remote should allow you to control OpenELEC.
For more options, OpenELEC has a useful page of documentation here.
Here is an excellent article which explains in detailed steps how to connect an IR sensor to the Raspberry Pi and setup any IR remote: