When we are given the Holy Spirit and we know His word we receive discernment from God.
Thus we know when something is not right when we are exposed to false teachings/doctrine as the Spirit alerts us by recalling Scripture to us that exposes the error. Scripture cannot lie and the Spirit guides us into all Truth.
This is called discernment and comes to us when we allow ourselves to be trained by the Holy Spirit in the Word.
The more a Child of God abandons themselves from religion and error the more they understand, know an see.
This is exactly what our Lord prayed for us in John 17 -
I have given them Your word; and the world has hated them because they are not of the world, just as I am not of the world. I do not pray that You should take them out of the world, but that You should keep them from the evil one. They are not of the world, just as I am not of the world. Sanctify them by Your truth. Your word is truth. As You sent Me into the world, I also have sent them into the world. And for their sakes I sanctify Myself, that they also may be sanctified by the truth.
“I do not pray for these alone, but also for those who will believe in Me through their word; that they all may be one, as You, Father, are in Me, and I in You; that they also may be one in Us, that the world may believe that You sent Me. And the glory which You gave Me I have given them, that they may be one just as We are one: I in them, and You in Me; that they may be made perfect in one, and that the world may know that You have sent Me, and have loved them as You have loved Me.