If your keyboard uses a PS/2 connector or the older large 5 pin connector turn off the PC first. If your keyboard has a USB connector, it can be safely connected or disconnected while the PC is powered on.
If your keyboard connector does not match the connector type on the PC, adapters are available for just a few dollars.
PCs with PS/2 connections will usually have two ports. One port is for the mouse and the other is for the keyboard. Look for a small icon near the ports to identify which is which. You may also inspect the motherboard for a label that identifies the port. If all else fails, take a guess and start the PC, if it beeps, won't start or otherwise behaves strangely, then turn it off and switch wires.
Keyboards with USB connectors can be plugged into any USB port. Ports on the front or the back can all be used. If your PC has PS/2 connectors, you can still switch to a USB keyboard.
That's it! No other configuration or changes are necessary.