The core answer lies in Rashi (Bereishit 29:25), who explains that Rachel, seeing Leah being brought to Yaakov in her place, said to herself 'now my sister will be shamed,' and so handed over to Leah the very signs Yaakov had arranged with her, enabling the substitution to succeed without exposure.
Eikhah Rabbah, Petichta 24 has Rachel herself recount this before God: she loved Yaakov, knew of her father's plan to switch her for Leah, had given Yaakov a sign to prevent exactly this deception, and then overcame her own distress to hand that sign to her sister so that her father's plan would not bring Leah to shame.
Bava Batra 123a grounds the arrangement earlier: Rachel herself warned Yaakov that Lavan was deceitful and would substitute her older sister, and she and Yaakov prearranged signs specifically so that no deception could succeed between them — which is the very mechanism Rachel then voluntarily dismantled for Leah's sake.
Midrash Tanchuma, Vayetzei 6 shows this was not an isolated act but consistent with Rachel's character: she had already stayed silent when Lavan diverted Yaakov's betrothal gifts to Leah rather than embarrass her sister or implicate her father, giving the sign-transfer a precedent in her pattern of self-sacrifice for Leah's dignity.
Bereishit Rabbah 70:19 and Bereishit 29:23-30 record the aftermath — Leah answering in Rachel's voice all night, and Yaakov's shock and confrontation with Lavan in the morning — showing how completely the ruse, enabled by Rachel's signs, worked until daybreak.
The moral difficulty is sharpened by the Ramban (Bereishit 29:31), who states plainly that Leah deceived both her sister and Yaakov, and that even granting her filial submission to Lavan she should at least have signaled who she was during the night — yet God, knowing she acted in order to be married to the righteous one, had compassion on her; this frames Rachel's complicity in the same light of weighing deception against a greater good.
The Ramban (Bereishit 29:27) reads Lavan's words to Yaakov as themselves a crafted deception, suggesting the whole episode was embedded in a household already practiced in such schemes, against which Rachel's sign-transfer operated.
Or HaChaim (Bereishit 29:25) adds that Yaakov's own reaction - resolving not to divorce Leah but to keep her as a wife, and choosing his words to Lavan carefully - reflects an awareness that what had been done, including the deception enabled by the signs, could not simply be undone, and that undoing it morally would itself cause further harm.
Megillah 13b credits Rachel's conduct here as an act of modesty for which she merited that Shaul descended from her, suggesting Chazal viewed her role not as mere trickery but as a mark of her character.
The question of whether altering truth to spare embarrassment is sanctioned is addressed directly by Shevet HaLevi (5:2), who discusses when speech may be modified to prevent humiliation, comparing the dispute between Beit Shammai and Beit Hillel over praising a bride and Rav Pappa's statement in Berakhot, concluding that wording whose underlying intention is truthful may be permitted for a compelling need or to preserve human dignity.
Several further sources round out the episode's background: Bereishit 29:27-28 records Yaakov's subsequent marriage to Rachel after completing Leah's bridal week, the Sforno (Bereishit 29:31) explains Yaakov's suspicion of Leah's motives once he recognized signs of barrenness in her, Midrash Tanchuma Buber, Vayetzei 12 discusses Yaakov's reasoning in seeking Rachel specifically, Kedushat Levi, Vayetzei builds on Rashi's comment about the signs Rachel transferred, Shiurei Daas 3 p. 134 addresses why Yaakov specified 'your daughter Rachel' to prevent substitution, Pirkei DeRabbi Eliezer 36:15 recounts Rachel's death in connection with Yaakov's unwitting oath, Turei Even, Megillah 13b discusses the textual basis for calling Lavan Yaakov's 'brother,' and Responsa Rav Pealim, Sod Yesharim 7 discusses how Leah and Rachel came to know the ways of God despite Lavan's idolatry.