Leia always knew.
Growing up on Alderaan, her foster parents were completely upfront with her about who she was and where she'd come from, so that she knew Darth Vader's name was actually Anakin Skywalker. In time, she understood the importance this information held for the cause of the Rebel Alliance.
As one of the major worlds in the Old Republic, Alderaan maintained a certain status even in the era of the Empire. Leia's title of Princess didn't originate there but rather on Naboo, since she was the daughter of the late Queen Amidala, Vader's wife. This gave Leia diplomatic immunity, at least for a while, and allowed her the chance to run what were called "mercy missions," until the grip of the Emperor closed, the Senate was dissolved, and the existence of the Death Star became public knowledge.
She had to act quickly, for Leia was aware that she had become expendable. First, the plans for the Death Star had to be smuggled to the Rebellion, knowing full well that this would expose her activities once and for all for what they had always been. She would become at best a prisoner, and at worst another of the executions that had become so commonplace. There was one thing Leia knew that could save her, a lie, one so cunning that the Emperor himself would be convinced:
She created the existence of a brother.
Quietly, for years, since she was a little girl, Leia had become aware that she had access to the Force. Without proper training, of course, her abilities could only go so far. Consequently, she developed her mental powers first and best of all. She learned that she could implant false visions, and that was exactly what she did.
Vader, her father, would be the easiest to fool. Leia had been spirited away at the moment of her mother's death, Leia's own birth. Her first awareness of the Force was when she discovered that she somehow still retained memories of her mother despite that fact, images she received in the womb of the emotional torment caused by her father's descent to the dark side. The only part of Vader that retained any good was the continuing desire to believe his love for his wife could still overcome everything else he'd become. His love for family, that is to say.
Vader didn't know about Leia, but he couldn't help noticing if someone bearing the name of Skywalker emerged on Tatooine, someone his Jedi master Obi-Wan Kenobi had been charged with protecting. The bait he couldn't refuse. He would try to reunite with his son, just as the Emperor would try and recruit the boy, to replace the man Kenobi had damaged beyond reasonable repair on the same fateful day of her birth.
It all went according to plan. Leia recruited a freighter pilot who had a friend willing to play the part, someone who'd been living on Tatooine, become friends with Kenobi, who regrettably would have to be an unwitting pawn in what she had begun calling the sibling affair, perhaps even a sacrifice. She didn't foresee falling in love with the impostor, however, much less the freighter pilot.
In the end, though, she discovered that like her father, love was her way out of the mess she'd created, something to hold onto. And unlike her father, something to build on.
And yet, somehow she always knew.