How does a typical electric rice cooker work?
Inside the rice cooker, there's a thermostat monitoring the bowl's temperature (and kept in firm contact with the bowl via the spring).  As long as the temperature doesn't go above the boiling point of water, the rice cooker keeps cooking.  Once it goes slightly above that point, the water must have all boiled off or been absorbed, and that means the rice is done, so the cooker switches to a much lower "keep warm" setting.  This approach works only for foods that start wet and are done once the standing water is gone, which is why automatic rice cookers are common but there's no comparably simple way to automatically cook pasta.

Fancy rice cookers can be far more elaborate (with microprocessors and whatnot), but simple rice cookers are very simple indeed, with no timing mechanism at all.  This means they rely on putting in an appropriate amount of water for how much rice you are cooking.  If you put in too little water, the rice cooker will stop when it's gone but the rice won't be done.  If you put in too much, you'll get overcooked rice.  Fortunately, rice is not super sensitive and you don't have to measure carefully, but you need to get it approximately right.

For different amounts of rice, you just have to scale the water accordingly.  For lentils or beans, you'll have to use a different water ratio, and you should look it up for the beans you have in mind (and to make sure they can be cooked reasonably in a rice cooker in the first place); I don't know how to predict it from first principles.