Confidence, in the New Testament, refers to Spirit-given boldness, both in witnessing for Christ and in approaching God in prayer and at His return. So John emphasizes the need to persevere through trials so that when Christ comes, the faithful may stand before Him with assurance, joy, and unashamed.
And those who remain faithful will experience confident acceptance, while those who abandon Him will feel deep shame, regretting their unbelief, cowardice, ingratitude, false hopes, and the sinful choices that lead them away from the Redeemer.
If we know He is righteous, we understand that everyone who practices righteousness is born of Him. If we live in righteousness, we remain in Christ. Born of Him and remaining in Christ are basically the same things.