There are a lot of keyboards to choose from! Some are MIDI but nowadays more are USB, and I like that better. Some electronic keyboards are like organs, the keys are spring-loaded. Others are more like pianos with 'weighted' keys that feel like a piano. The feel is different and the technique is different. Other than that, they all work about the same.
Some keyboards are standalone musical instruments, so they have their own sound-creating capabilities. You can use them as an 'input device' for the computer, and then the computer can 'play' them by remote control. Other keyboards are only keyboards, so you use the sound-producing capability of the computer itself. The keyboards with their own synthesizers in them can be used this way too.
As for software, I'm not a Mac person but I know there are many 'sequencer' programs that allow you to play and 'record' your keystrokes, then edit them, transpose them, change the tempo, etc. The famous ones are Cubase, Cakewalk, etc. and you hear about them all the time. I'm sure they're available for the Mac as well as the PC. A very famous sequencer for the Mac is Garage Band. There are also 'soft synths'--synthesizers (sound producers) that live in software, so you don't need a hardware synthesizer. I'm pretty sure the Mac comes with one built in (like PCs do these days), but you can get others that have more capabilities.