First of all you need to purchase a PS2 to USB convertor from your nearest computer hardware store. While these convertors are fairly cheap, they can be hard to find now that they are of very limited use.
Once you have a convertor, simply plug its USB end into the USB port of your computer (your computer can be switched on during this, there is no problem with that).
Now take the wire from your PS2 keyboard or mouse and look at the pins at the end. Hold up the other end of the PS2 to USB convertor and align the holes on the convertor’s end with the pins on the keyboard or mouse before connecting them.
Once the keyboard or mouse is connected with the PS2 to USB convertor, Windows will automatically detect the device and install the relevant drivers. Once that is completed, you might see a notification in the tray on your task bar and your device should be operational now.