Rhythm Is a Dancer’ is the song that does it for me.

It’s a tune by the German Eurodance group Snap!, that was played a lot one summer as I travelled across Europe. I hear just one refrain from it – “It's a soul companion/ You can feel it everywhere” – and the late nights and sandy beaches come immediately to mind. But were I deliberately to try and remember something particular from that holiday, without the music, I would recall nothing as immediate or emotional. This is an experience shared by everyone: hear a piece of music from decades later and you are transported back to that particular moment, like stepping into a time machine. You can feel everything as if you were actually there. The relationship between music and memory is powerful, and new research is hoping to discover how these memories work for therapeutic effect. It is already used to help dementia patients, the elderly, and for those suffering from depression.

Music has been an important mnemonic device for thousands of years. David C Rubin is a specialist in autobiographical memory and oral traditions and in his ground-breaking book Memory in Oral Traditions he explains how epic stories like Homer’s The Iliad and The Odyssey were passed down verbally using poetic devices. Before the narratives could be written down, they were chanted or sung. Oral tradition depended on memory.

The hippocampus and the frontal cortex are two large areas in the brain associated with memory and they take in a great deal of information every minute. Retrieving it is not always easy. It doesn’t simply come when you ask it to. Music helps because it provides a rhythm and rhyme and sometimes alliteration which helps to unlock that information with cues. It is the structure of the song that helps us to remember it, as well as the melody and the images the words provoke.

The technique remains important today. Neuroscientists have analysed the brain mechanisms related to memory, finding that words set to music are the easiest to remember. Just think of one of the first songs you could well have sung: “A,B,C,D,E,F,G, come along and sing with me.” Text learnt to music is better remembered when it is heard as a song rather than speech. Try and remember anything set to a tune and your powers of recall will be stronger: “Now I’ve sung my ABC.”

All in the mind

There is a link then between music and memory, but why, when we hear a particular song, do we feel strong emotions rather than just being able to recite the lyrics? If I listen to Rhythm Is a Dancer, I recall the amazing feeling of travelling without my parents for the first time and all the fun I had as much as the lines of the song, which I might add wasn’t one I cared for particularly − the lyrics are banal or just plain bad. "I'm as serious as cancer when I say rhythm is a dancer" was described by one critic as the ‘worst lyric of all time’ and yet it evokes profound feelings.

There are different kinds of memory, including explicit and implicit memory. Explicit memory is a deliberate, conscious retrieval of the past, often posed by questions like: where was I that summer? Who was I travelling with? Implicit memory is more a reactive, unintentional form of memory.

“A large part of memory takes place in the unconscious mind” Robert Snyder, a composer and chair of the sound programme at the Art Institute of Chicago, tells me. “There are aspects of memory that are remembered implicity, that is, outside of consciousness”. What’s more, he says, “implicit memory systems involve different parts of the brain than explicit memory systems”. It is the explicit memory systems that are damaged by conditions such as Alzheimer’s disease. Implicit systems are robust in comparison. Snyder explains that “things that can affect us from outside of consciousness are often regarded as powerful”. In other words, implicit memory is emotional as well as durable.

Notably, memories stimulated by music often come from particular times in our lives. Classic hits take us back to our teenage years and our twenties, much more than songs of later years. Psychologists have called it the ‘reminiscence bump’. It may work this way because this is an especially important and exciting time in our lives, when we are experience things for the first time and when we become independent. Everything is new and meaningful. Later, life becomes a bit of a blur. Music evokes emotion, but the sound and feeling of it, while important ,don’t necessary define your feelings. A sad song could be associated with a happy time, a happy one with a sad one.

Soundtracks of our lives

It's often pop music that evokes memories from this time in our lives. Why? Well, for a start this music played in the background, whether we selected it or not. There is always something on the radio, in bars, clubs and bedrooms that is contemporary and is almost accidentally attached to a particular time. Pop music is also of the moment. Listen to popular music from the 1960s and 1970s, for example, and you think you know what that time sounded like. There is something more abstract about, say, western classical music, which has become more detached from its original time and may be harder to place.

Cretien van Campen, author of The Proust Effect: The Senses as Doorways to Lost Memories researches the ways different senses act like the madeleine for the French author Marcel Proust in In Search of Lost Time when a bite of the sweet cake takes him back to his childhood with all its smells, colours and feelings. Much of Campen’s work studies the brain, but he makes an important observation about what happens outside of our heads. “Smell differs in that it is a personal memory, whereas there is something very social in our experience of music,” he points out. “Music memories are often shared with peers.” We listen, together. At a party, it is something that we hear whilst dancing or chatting to a friend. We go to concerts or gigs with one another. And it is because music is there as part of lives spent with others – often significant others – that helps make it especially meaningful. Indeed it is often played at or composed for significant occasions, like funerals or weddings, where we witness major life events.

People who have suffered traumatic brain injuries will often have problems with memory. Music can help bring back some of those special moments of their lives that they have forgotten. Those suffering from dementia can trigger vivid memories by listening to music they heard when they were young. Campen also highlights its uses for those with depression. It can assist people to recall difficult parts of their lives that were not necessarily as bad as they had thought. “People who are depressed often feel as if there is a blanket over their lives”. Hearing music, and remembering various experiences, “can help them remember the more complex experiences.” It’s not that these are always positive, he notes, “but they may be more rounded.” Music cannot cure, but perhaps it can help heal.

Campen is optimistic about the future work: “People worry a lot today about forgetting and the problems with memory. But the beauty is today we are beginning to help with remembering.”

For many, that will be music to their ears.

If you would like to comment on this story or anything else you have seen on BBC Culture, head over to our Facebook page or message us on Twitter.