There are four questions in one:
If I change the RAM
- YES the new RAM is recognized.
I change the GPU
- This will require installing new drivers. You need to post a question on your specific GPU. It's almost certain after changing GPU you'll have to interrupt
grub boot with e and edit command line with nomodeset, or nouveau.modeset=0, or nvidia.modeset=0 or radeon.modeset=0depending on what the old GPU was.
If I install Ubuntu on a SSD (SATA III or NVMe m.2) and later move it to a new computer with different CPU and motherboard.
- Yes. But see summary below.
If I change the CPU or the motherboard
- Yes. But a new CPU might require a microcode update for optimum performance. Note I think this is really the same as question 3, but in reverse.
Summary
Linux does things on the fly unlike Windows which locks you into drivers that must be installed during system setup. Any piece of hardware in Ubuntu though may require a grub override for successful booting. These you can fix on the fly though by pressing e in grub to edit the command line and pass the appropriate parameters to the kernel. Then after successful boot, make permanent changes in /etc/default/grub and run sudo update grub.