Press the hotbar number to select the food and hold it in your hand. Press and hold the "Use Item" button. This is usually the right mouse button but can be changed to other keys. Continue holding the button until the food has been completely eaten.