It depends on the keyboard.
If your keyboard has PS/2 connector, then it should work immediately. If it doesn't, then it is either broken or your motherboard is broken.
If it is USB keyboard, then there might be a problem with drivers. Try reinstalling drivers, or letting windows install generic drivers, it might help.
If it is wireless keyboard, then there is probably no solution. You can still try updating / reinstalling drivers, but I don't know if that will work.
Alternatively, try plugging out your keyboard and plugging it back in, and maybe that will help.
If your motherboard is old or your keyboard is old then there might be problem where motherboard doesn't recognize your keyboard. Easiest solution is to get a new motherboard (if your motherboard is old), or get new keyboard (if the keyboard is old).
But that is probably not the solution you are looking for. You can try the following, but I can't guarantee it will work.
Try updating the BIOS. If updating drivers for the keyboard doesn't work, then updating the bios is probably the best thing you can try. I however don't know the safest way of updating the bios, so if you're going to try that, try to get informed before you try.
I hope this helps.