Connecting a keyboard with a MIDI output to a computer without a MIDI input can be done using a MIDI to USB cable. These cables are easy to connect and use, and usually do not require any additional software.
Newer keyboards often have a USB port that can be used to connect the keyboard to the computer via a standard USB cable.
A keyboard can be connected to a computer's MIDI input by using a MIDI to MIDI cable. Many computers do not have a MIDI input, and many need a special sound card to connect to them with a MIDI cable.