As we begin in Chapter 36, the whole chapter is a genealogy of Esau's family. After this genealogy, little is said about Esau in Scripture, as he and his descendants have little involvement with the plan of salvation that God is communicating through Scripture. However, in the extrabiblical texts, Esau is mentioned first in Jasher 56, where he mourns his brother's death and then has a dispute with Joseph over Jacob's burial, as Esau's family is trying to resist the burial. A battle ensues, and Joseph along with his Egyptian allies, prevail and Jacob is laid to rest. However, this causes a war that ensues all the way through Jasher 60, when a grandson of Esau's, Zepho, is said to have fled from the Egyptians and somehow becomes a ruler in Italy. Esau is recorded in Jasher 56:64 as being killed in battle by Dan's son Chushim, and he is decapitated at that time just prior to Jacob's burial. So, then, it is the extrabiblical sources that record the death of Esau rather than Genesis, but this is understandable as again Esau's lineage plays little part in the overall plan of salvation recorded in Scripture itself (references to Jasher from Ken Johnson, The Ancient Book of Jasher. Olathe, KS: Biblefacts Ministries, 2008. pp. 126-141).
Returning to the Genesis account, the genealogy of Esau is summarized in the chart below regarding Genesis 36:1-30:
Esau had 3 wives, all of whom are documented in this passage - Adah was a daughter of Elon the Hittite, Oholibamah the daughter of a man named Ana, and Basemath is Ishmael's daughter. The chart above though misdocumented one thing - Eliphaz, Esau's son, had Amalek as a son by one of his concubines Timnah, and the others mentioned are also Eliphaz's rather than Esau's sons. Amalek would later by the progenitor of his own nation, the Amalekites, who would figure prominently during the era of the Judges later as the early Israelites had to contend a lot with the Amalekites in the land of Canaan.
From verses 31 to the end of the chapter, there are a list of Edomite kings that extends for several generations, and no doubt this was included in the Genesis account to provide background for the later dealings that Moses and his successors would have in Canaan with Edom and others. It is also worth mention that a later descendant of Esau would rule Judah - during the Hasmonean period many centuries later, as the Hasmoneans began to have internal conflicts among themselves and Rome was starting to take advantage, an opportunist named Antipater seizes the opportunity to court Rome and gain influence over the Judean court, and eventually he even marries one of his sons to a daughter of one of the Hasmoneans. Antipater was an Idumaean, which means he was from a region east of the Dead Sea called Idumaea, which is a Latinized name for Edom, the land of Esau's descendants. In essence, Antipater was a descendant of Esau, and his sons, the Herodians, would rule the region for at least three generations. Although adopting the Jewish religion (at least outwardly) and gaining favor with the Sadduccee caste in Palestine at the time, the Herodians were thoroughly Edomite in origin. It was one of the few times a descendant of Esau ruled over the children of Israel, but many centuries later.
Proceeding now to Chapter 38, we have the story of Judah and his daughter-in-law Tamar. The story starts with Judah taking a Canaanite woman by the name of Shua as a wife, and she bears him three sons - Er, Onan, and Shelah. When Er, Judah's oldest, comes of age, he arranges a marriage for him with a beautiful local girl named Tamar. However, Er is apparently not a nice guy, as the Scriptural account in this chapter records him as being evil, and a course of divine judgment ends his life. As was the custom, the widow Tamar is then given to the next brother, Onan. Onan apparently has some scruples about him, and doesn't feel right about the arrangement, and rather than consummating his marriage with Tamar, he instead ejaculates his sperm on the ground. This action of Onan's is also seen as evil by God, as there would soon be strict commandments against this sort of thing in later Mosaic law as recorded in Leviticus, so Onan loses his life in judgment as well. Tamar is promised by Judah to the third son, Shelah, but Shelah is still too young yet to marry. Therefore, until Shelah comes of age, Tamar is sent back to her family. In the same time period, Judah's wife Shua dies, and in order to cope with the loss and as part of the mourning process, Judah goes to the nearby area of Timnah to sheer sheep with his herdsmen. Tamar finds out that Judah is in the area, and fearing for her own lack of posterity and the fact that she would be much older than her betrothed, she conspires to seduce Judah into bearing children by dressing up as a prostitute and seducing him.
Obviously, consorting with whores was wrong, and Judah should have known better. However, he decided to indulge himself of some "pleasure," and negotiates to pay Tamar (whose identity is hidden) a goat in payment for her "services." Knowing full well what she was doing, Tamar coyly makes Judah pledge on the payment by asking for his signet ring and staff (signs of his authority) as collateral until payment is made, and Judah obliges her. Judah's tryst with Tamar results in a pregnancy, which was her plan, and this presents a problem. When Judah tries to pay the supposed whore for her "services" by sending the goat to her, she is nowhere to be found and the local people know of no prostitutes in their town. However, in due time Judah does learn of the pregnancy, and he initially wants her killed as a penalty for her fornication (since she was legally betrothed to Judah's son Shelah, technically this would have been considered an act of adultery).
Upon demanding the father of the child's identity, Tamar sends to Judah his own staff and ring with a message that they belong to the father. Judah by this time feels stupid about it, and despite the embarrassment caused by the whole incident, he acknowledges what he did and never "knew" her again. In due course of time though, Tamar gives birth, and she ends up having twins. When the first - Zerah - puts out his hand, Tamar ties a scarlet thread around it, but the hand withdraws and the actual first-born - Perez - comes out first instead. Perez would be the line from which eventually all the kings of Israel and Judah, as well as the future Messiah, would come.