1) There are many different kinds of memory, and they work in different ways. For example, the kind of memory you use to remember a phone number for a few seconds is different to the kind of memory you would use to remember the name of the capital of France. Another kind of memory is used when you remember a complicated pattern of actions (such as swimming, riding a bike or playing a familiar piece of music on the piano). Another kind of memory is used when you remember every day events (for example, being at your Aunt’s wedding). This kind of memory is called episodic memory, and I’ll focus on it for the rest of the answer. Characteristically, when you remember one aspect of an event other aspects tend to come flooding into your mind without any apparent effort – at least that’s what friends tell me; I am not sure if it is the same for everyone 😉
2) All the memory systems are thought to work by changing the strength of connections between nerve cells (“neurons”) in the brain. There are around 100 billion neurons in the brain, and each neuron is connected on average to around 10,000 others, and the connections are used to send signals between cells. Depending on the signals passing through them, the connections can get stronger or weaker, and the changes can last for hours, weeks, months, or presumably years.
3) This mechanism (called Long-Term Potentiation) can be used to form strong connections between neurons which “represent” different things. For example, one recent study found a neuron which signalled when a man was watching a video clip of the Simpsons (but not other video clips). The same neuron signalled again when he remembered the clip (but not other clips). By linking together different elements of the same event or experience, the different neurons can “wake one another up”, so that if one starts signalling eventually all the neurons linked to a particular memory start to signal.
4) The hippocampus is the part of the brain that is thought to be specialized for forming these links between different aspects of the same events. If the hippocampus is badly damaged, then the ability to form new memories of personally-experienced events can be lost – which is what we call amnesia The link is a Youtube video from a documentary about a patient with amnesia, Clive Wearing. Patients like Clive who have dense amnesia can still use some of the other memory systems, for example, they can still play the piano, walk, understand the meanings of words, and remember phone numbers for short periods. In fact, this is one of the ways we can tell that the episodic memory is different from the other kinds.
Long answer, but there is a lot more to say; in fact there’s a great deal we still don’t know about memory, and some of what we think we know now may one day turn out to be wrong.