Apparently, there’s some coordination mechanism, where you tell the OS that you want to remove a certain memory stick, so it moves all the memory onto other RAM sticks (or uses paging to move it to your hard drive). Only then would you actually physically unplug the memory stick.
See, for example: docs.kernel.org/…/memory-hotplug.html
(Mind that this is kernel documentation. If you actually want to do this, there’s probably some CLI program to make it easier.)