Genesis 19:29 “So it was that, when God destroyed the cities of the valley, God remembered Abraham and sent Lot out of the midst of the overthrow when he overthrew the cities in which Lot had lived.”
God spared Lot’s life because of God’s covenant with Abraham. God “remembered” Abraham; that is, he knew he had covenanted with Abraham. That covenant was intact and had bearing for Abraham’s relationships. God did not spare Lot because of his righteousness but because of Abraham.
One commentary said this:
The verse includes an explanation for Lot’s deliverance, attributing his salvation to God’s covenant relationship with Abraham. “Remembered” (zākar), another allusion to the flood (8:1), is typical covenant terminology, indicating loyalty (e.g., Exod 2:24; 6:5; 32:13; Pss 105:42; 106:45)…“God remembered” identifies the prior covenant obligation (12:3) as the basis for the divine intervention, not the righteousness of Lot. Although the mention of Abraham brings to mind the appeal of the patriarch (18:16–33), “God remembered” directly refers to the privileged position of Abraham. The divine motivation for the initial disclosure to Abraham is his election (“For I have chosen him,” 18:19), which then prompted his intercession for the cities. That God’s benevolence toward Lot arose from his commitment to Abraham thus begins and ends the Sodom segment (18:17–19; 19:29). – New American Commentary, Genesis by K.A. Mathews