I have a MIDI keyboard and a microphone, I would like to form an output combining both, and be able to select it among my microphones available in Discord or TeamSpeak for example. Is this possible via software or do you have to buy equipment to do this?
The MIDI keyboard doesn't actually make any sound. It needs somewhere a MIDI sound generator to convert MIDI into sounds. (You can generally choose which instrument you want to play with the keyboard from the ones available on your sound module.)
The sound module you use might be a separate piece of hardware (a box with a MIDI in connector and an analogue audio output) or a "virtual" sound module which is part of some audio recording package ("DAW").
The mic does make an audio signal but it is very small and will need to go through a preamplifier to bring it up to "line" level - this is basically to make the mic signal bigger, to a size (voltage-wise) similar to the output of the MIDI module (if that's what you use).
So there are different ways that you could do this:
Scenario A : if you just want to record the mic and MIDI (say piano) together you could use a simple DAW package like Cubase Lite (NOT Ableton because it has no MIDI support). Cubase quite likely has some MIDI sounds (which take the place of your sound module) packaged. So for this, you need a PC/Mac with your DAW of choice, and an interface with at least one microphone input (which has the preamp) and a MIDI input (which will send the MIDI info to the DAW). (Almost all home interfaces have both of these.)
Scenario B : if you want to use the keyboard as a piano and perform live you need some form of sound module and a mixer with a mic preamp (most have several) and a line input for the output of the MIDI sound module.
So in Scenario A, you have an external audio interface, mic and MIDI go into it and everything happens on the computer.
In Scenario B, MIDI goes to Sound Module MIDI IN, Sound Module line out (maybe stereo) goes to mixer, and mic also goes straight into mixer Mic IN.
The PC usually accepts USB and may have a small jack socket for audio input to the PC's sound card.
CThe MIDI keyboard outputs digital data through either USB or through a MIDI connection which uses a 5 pin DIN socket..
The microphone outputs an audio signal. Different mics have very different capabilities. Condenser mics need power usually 48V DC. Mics with built-in pre-amplifiers need power either a battery or some other power supply. Some mics with pre-amplifiers may have USB interfaces built-in too. Plugging a USB Mic into your PC will usually supply enough power for the microphones electronics.
If everything uses USB it is likely to be easy to make it all work together as you wish. Plug USB microphone and MIDI USB into PC, which will act as the Host. Then just need to find the software.
If the Mic is a dynamic Mic it is possible that the sound card in the PC will be sensitive enough to make the microphone loud enough. If not you will need a microphone amplifier or pre-amplifier You will need a separate preamplifier to use a condenser microphone as it needs power. In either case buying a decent USB pre-amplifier may be necessary to get the signals into the PC via USB.
A MIDI keyboard without USB will need an interface device to convert MIDI to USB for your PC. If you have a separate MIDI synthesizer, it may use MIDI plug/sockets and output audio via USB.
More specific answer will depend on exactly what devices you have what their specifications are and what you PC can do.
I hope this helps.