Decide on the right connector. If you need to run several MIDI instruments at once, you will likely need a more complex connector, such as an interface unit; if you're just connecting to a single instrument, a simple USB to MIDI cable will suffice. Prices generally range from the $30 range to several hundred dollars, depending on the connector, and can usually be purchased through a music store or online. (Some online stores are listed below in Resources.)
Connect the MIDI side of your connection to the "MIDI In/Out" ports on your instrument, and the USB connector to your laptop. Power the instrument on, if necessary, so the computer recognizes it as a new piece of hardware. According to Music On My PC, most USB devices are now Plug-and-Play and will do most or all of the configuration automatically.
Open the music software on your laptop. Test the connection; play your instrument and make sure it is registering on your software and is properly configured. If not, go into the "Preferences" or "Configuration" sections of the program, make certain it recognizes your MIDI instrument, that the program is configured to receive a signal from an external source, and that you have the program and instrument(s) set to the same MIDI channel. This step might take some work and concentration to get right, so be patient. Refer to the user guides for the software and/or instrument if you run into trouble.
Use the new connection for recording, notation, playback or whatever other application for which you are using the MIDI connection.