Sum and difference
Left and right is one way to hold a stereo signal. Mid and side is another, and it is the same information: mid is what both channels share, side is what only one of them has. The conversion is two additions, and it reverses exactly.
Mid carries the centred material, which in most music is the lead vocal, the kick, the snare, and the bass. Side carries the width: room, reverb, wide guitars, and anything panned hard.
Three modes
Process converts to M/S, applies the two gains, and converts back. The file goes in as stereo and comes out as stereo. This is the everyday mode.
Encode stops halfway and writes M and S as the two channels of the output. Opened in any player, the left channel plays the centre of the mix and the right channel plays the difference, which sounds strange and is meant to. It is a handoff format for another editor.
Decode does the second half on a file that already holds M and S, turning it back into normal stereo.
What separate gains buy you
Dropping the side narrows the image; raising it widens it. Dropping the mid pushes centred material back without touching the room around it, which is closer to a rough vocal-down than an EQ move can get.
Small amounts do a lot. Beyond about 6 dB of side boost, the centre starts to sound hollow and the mix loses its mono fold.
Check the mono fold
A wide file summed to mono loses the side signal entirely, because +S and -S cancel. Anything you push into the side is therefore invisible to a phone speaker, a smart speaker, or a club PA in mono.
Measure it rather than guess: the stereo field analyzer reports mid and side levels and phase correlation for a file, which tells you how much survives the fold before you commit.