Purchase a USB to MIDI cable or interface. Depending on your needs, a variety of items are available. Many audio interfaces are capable of converting MIDI to USB and vice-versa. Furthermore, you can buy stand-alone cables which can connect a MIDI device to a USB port.
Connect your MIDI/USB converter to your computer's USB port.
Connect the MIDI cables to your MIDI device. Make sure that the MIDI In and MIDI Out cables go into their corresponding ports on your MIDI device.
Turn your MIDI device on, if applicable.
Open the software on your computer for which you wish to use the MIDI device. If you are using an audio interface to route your MIDI, you may need to enable the MIDI device in the standalone software for your interface.