How Leia truly remembers Padme is considered a plot hole itself. In the original draft, the twins' mother and Anakin ended their relationship before Padme discovered her pregnancy. After the twins' birth, Padme took Leia to Alderaan and Kenobi took Luke to Tatooine. Leia again was adopted into the Royal House of Alderaan. Their mother's fate again becomes unknown. However, within the 1983 official novelization of Return of the Jedi written by James Kahn, it is stated that Leia remembers actual memories of her mother:
Return of the Jedi by James Kahn, p 148
He looked down at their intertwined fingers. 'Leia...do you remember your mother? Your real mother?'
The question took her by surprise. She'd always felt so close to her adopted parents, it was as if they were her real parents. She almost never thought about her real mother -- that was like a dream. Yet now Luke's question made her start. Flashes from her infancy assaulted her -- distorted visions of running...a beautiful woman...hiding in a trunk. The fragments suddenly threatened to flood her with emotion.
'Yes,' she said, pausing to regain her composure. 'Just a little bit. She died when I was very young.'
Return of the Jedi by James Kahn, p 150
She looked away, she shook her head, she wouldn't look at him. It was terribly disturbing, what Luke was saying, though she couldn't imagine why. It was nonsense, of course; that was why. To call her the only hope for the Alliance if he should die -- why, it was absurd. Absurd to think of Luke dying, and to think of her being the only hope. Both thoughts were out of the question. She moved away from him, to deny his words; at least to give them distance, to let her breathe. Flashes of her mother came again, in this breathing space. Parting embraces, flesh torn from flesh...
George Lucas was quoted on this topic, saying back in 1997:
"....The part that I never really developed is the death of Luke and Leia's mother. I had a back story for her in earlier drafts, but it basically didn't survive. When I got to Jedi, I wanted one of the kids to have some kind of memory of her because she will be a key figure in the new episodes I'm writing. But I really debated whether or not Leia should remember her...."
Despite the novel being the official book adaptation for the film, certain aspects aren't canon any longer since Revenge of the Sith was released. But it does tell us that the original concept for Leia's memories of Padme would actually have been due to her age. However, there is still a logical explanation in the Star Wars universe itself for Leia's memories:
YODA: Through the Force, things you will see. Other places. The future...the past. Old friends long gone...
Since Leia is force sensitive, it is possible she saw Padme through the Force. Leia's connection to Padme has been highlighted before in a canon comic where Leia visits Naboo and she sees the portrait of the former queen turn and stare at her briefly.
In the Star Wars Adventures Annual 2019, the book's backup story, So Much More tried to answer this question as well. Leia's adoptive mother, Queen Breha talks to Leia in a garden where a statue of Queen Amidala is present. She talks to Leia about Padme, and tells her:
"Leia, love, I know you're too young to understand all this...to remember, even. But I want you to hold on to this image, this feeling. That spark -- the spark. You have it, too."
In the retelling of Return of the Jedi by Tom Angleberger, Leia doesn't even know if her memories are actually real:
"...Unsure, in fact, if she really did ever see her mother or just invented these memories to fill the hole in her life..."
The most logical explanation I can come up with is that Leia remembers Padme through the Force, hence why she isn't sure if her memories are even valid. But it appears that the actual answer varies according to the Star Wars material presented.