This seems to be a subject that won’t be fully understood until we see Jesus face to Face, when we know fully even as we are fully known (1 Cor. 13).
We know for sure that all born-again Christians have their names in the Book of Life, and only the overcomers do not have their names removed from it when they’re judged by Jesus.
This article makes key points:
It is good to have your name written in the Book of Life
The apostle Paul addressed his fellow believers as, “…my fellow workers, whose names are in the book of life” (Philippians 4:3 ESV). This clearly tells us that Christians have their names written in the Book of Life.
“The one who conquers will be clothed thus in white garments, and I will never blot his name out of the book of life. I will confess his name before my Father and before his angels” (Revelation 3:5 ESV). This passage tells us that perseverance is essential to one who has his or her name written in the Book of Life. Faithfulness to God is crucial to having one’s name secure in God’s kingdom. This verse also reinforces the fact that it is Jesus who determines whose name is, or is not, in the Book of Life. …
The Book of Life and judgment
“And I saw the dead, great and small, standing before the throne, and books were opened. Then another book was opened, which is the book of life. And the dead were judged by what was written in the books, according to what they had done” (Revelation 20:12 ESV). When God judges us, the Book of Life will play a prominent role, “And if anyone’s name was not found written in the book of life, he was thrown into the lake of fire” (Revelation 20:15 ESV). God keeps a record of how each of us responds to His offer of salvation. He sent His Son, Jesus Christ, to die on a cross to pay for our sin, the sin that separates us from Him. It is our repentance or rebellion that determines whether or not we will spend eternity with Him in paradise or apart from Him in Hell.
Nothing ‘unclean’ in the Book of Life
Speaking of the New Heavens and New Earth of the end times, Revelation says, “But nothing unclean will ever enter it, nor anyone who does what is detestable or false, but only those who are written in the Lamb’s book of life” (Revelation 21:27 ESV). Therefore, no one who is unclean has their name written in the Book of Life.