How was the curse lifted in Holes?
The curse you are referring to is first placed when Elya Yelnats seeks help from Madame Zeroni in order to win the love of an incompetent local girl, Myra Menke. Zeroni tells Elya to carry a piglet up the mountain every day and to allow it to drink from a special stream while singing to it—a feat which will make the pig grow larger and create strength in Elya. At the end of this process, Elya is supposed to exchange the pig for Myra's hand in marriage and then thank Zeroni by carrying her up the mountain to drink from the stream.
The curse is lifted several generations later when Stanley carries Zero up to the Big Thumb, resolving the failure of Elya (Stanley's great-great-great grandfather) to carry Madame Zeroni (Zero's ancestor) up the mountain. On the top of the mountain, Stanley and Zero eat onions and discover water sourced from the spring, which they drink from. Stanley also sings to Zero Zeroni's song.
By carrying out this task and negating Elya's own misdeed, Stanley restores luck to his family and causes them to suddenly accrue wealth in the form of the suitcase labeled "Stanley Yelnats," which contains the jewelry and other treasures that had previously been stolen from his ancestor.
The curse was blamed on Stanley's "no-good-dirty-rotten pig-stealing-great-great-grandfather." It has made it impossible for the Yelnats family to ever truly succeed at anything they try and their lives are rather difficult. Stanley feels the weight of this and when he is falsely accused of stealing a famous ball-player's sneakers, he assumes that it is his burden because of the curse.
The reason the curse is lifted is that Stanley is so selfless in helping Zero. The reason why this lifts the curse is because it is Zero's great-great-grandmother who put the hex on Stanley's great-great-grandfather after he refused to carry her up to the mountain as the price for her advice. So the debt is paid when Stanley carries Zero down from the mountain.
The curse is blamed on Stanley’s great-great-grandfather who did not fulfill his obligation to carry Madame Zeroni (Zero’s ancestor) up the mountain as payment for help he was given by her. The curse results in bad luck for the Yelnats’ family for generations. This curse is also blamed for Stanley’s current residency at Camp Green Lakes (and the false accusations of his shoe thievery).
In chapter 38, the curse is lifted when Stanley carries Zero up the mountain. This selfless act reverses the curse that the Yelnats’ family has endured for generations. Immediately, Stanley’s luck starts to change. Stanley finds onions to eat and discovers a water source to drink from. His family’s luck also changes for the better. Stanley’s father invented his foot odor cure the day after Stanley carried Zero up the mountain, the Attorney General closed Camp Green Lake, and valuables were discovered in the suitcase (labeled with his name) that helped Stanley improve his family’s financial situation (chapter 50).