How memory is stored in memories like SD Card, USB flash drive, etc. that the data stays even if removed to the device?
The data in modern EEPROMS are stored in tiny capacitors made of silicon, as the normal MOSFET transistors are made, just using two gates, one of which is "floating". But as should be understood, every capacitor has certain leakage, small, but... Therefore the data in flash memories have limited time for how long they keep the charge, called "retention time", typically 10-20 years, depending on quality of manufacturing and chip temperature. See, for example, this lecture for more details.