Judah had three sons: Er, Onan, and Shelah. Judah took a wife for Er his firstborn, and her name was Tamar. Er was wicked, so YHWH put him to death. Judah then gave his second son, Onan, for Tamar. And Onan died as well. Then Judah said to Tamar to wait until Shelah grew up. So Tamar stayed and waited. In the course of time, Judah’s wife died.
Then Tamar saw that Shelah was grown up, yet she had not been given to him in marriage. So she covered herself with a veil. Judah thought she was a prostitute, and come in to her. Tamar asked him to promise her that he would give her something first. And Judah promised that he would send her a young goat, and as a pledge he gave her his signet, cord, and staff. Never he knew that it would be used against him later on, to prove that he was the one who slept with Tamar (Gen 38).
Judah promised Tamar to give Shelah to marry her but he did not deliver his promise.
Then Tamar made him to promise one more time, which in the end would force him to deliver his original promise: to give Tamar a marriage. As the saying goes, what goes around comes around.