Being born again comes when we experience God personally, when He comes into our lives. This usually happens when we realize that we sinned against Him and believe that He sent His Son Jesus to live a sinless life and die a tragic death on a cross to pay for all of our shortcomings & failures. Then we cry out to God to forgive us in Jesus’s name or ask Jesus to come into our lives and be our Lord & Saviour. Salvation is free and entirely by God’s grace but we have to be willing to turn from our sins and turn to the Lord before He’ll save us.
It’s not based on our good works-it’s our hearts attitude toward God. God only reveals Himself to a lost sinner through the person of Jesus Christ when they seek Him. And no one seeks Him unless the spirits drawing them and they sense that nothing else in this world can make them happy.