Some of the quotes and information are part of the Nand2Tetris course available on Coursera.
The types are many but the ways they work are not
So, there are types of memory, Cache, RAM, ROM, Secondary Memory like Flash, etc. but all of these are fundamentally doing the same thing. At least from a logical standpoint.
What they have is a group of registers that work together. Now, what is a register you ask? That's the neatest part of a memory chip that creates an illusion of storage.
Repeat until I tell you to change it.
That's it, that's the principle behind the working of a register. Let's say you have a friend, you ask him to shout out 45 until you tell him not to. Now, did you really ask your friend to store it? Nah but you can at any point in time of the future listen, and determine that you asked him to shout out 45. You didn't store it, you just made sure it is repeated enough into the future. Neat eh? That's how a register works.
This is called the state of a register and it creates an illusion of storage. There's also another thing a register is defined with, it's the word width. In the virtual computer that I am building the word, length is 16-bit as It's a 16-bit computer that I am building.
RAM (Random Access Memory)
RAM can be thought of as a sequence of addressable registers. At any given point in time, only one register in the RAM is selected. To select we use a selection number that is of width k. Here k = log2(n) where n is the number of registers we have in the RAM. As RAM is created using a set of Registers which are built using Data Flip Flops, RAM is basically a sequential chip.
Now, where does RAM get its name from? From the ability to select any Register and know what's in the register instantaneously. Like seriously, even if you just queried the 1st register, you can immediately ask for the 3678th Register and you get it in a clock cycle. It's just a matter of selection rather than searching. Definitely a thing of beauty.