From Jesus' statement in Matthew 7:21-23 we know it must be possible for one to be wrong about their salvation. Let's take a moment to consider a few reasons why someone might think they are saved but actually be lost.
Some depend on their good works
The following is a paragraph I found at Life Application Ministries:
The unforgivable sin is rejecting Christ and His gift of salvation. That is also the only SIN that will cause you not to be saved. So for those of you who have prayed for Jesus to forgive you and you have received Him as Savior, get it clear right now - YOU ARE SAVED. This is how you can tell. Do you have a desire to love God? Do you have a desire to do things right? Do you have a desire to help other people? Do you want to have a closer relationship with God? Do you want to change? Do you want to read your bible and pray more? If you have answered YES to any of these questions, YOU ARE SAVED. I'll tell you why. Only the Holy Spirit puts in us the desire to seek God. If the Holy Spirit weren't there, you would be seeking everything BUT God. So, if you have a desire, even a tiny drop, to seek God and follow Jesus, you are saved. But, if you don't then you need to stop right now and get that right with God. Click HERE to receive Christ as Savior.
The author of this article is clearly depending upon good works to save him (and encouraging those who read his article to depend upon their good works to save them). There is no New Testament scripture that teaches one to simply pray a prayer and receive Jesus as their savior. Take a moment to read Matthew 7:21-23 again. These people used their good works during their lives on earth as proof of their salvation. But Jesus said He never knew them and called them workers of iniquity. Does this mean that good works are not required? Absolutely not! I've published an article on works and salvation to this site. Feel free to take a moment to read it. So one reason people will be mistaken about their salvation is because they are depending upon their good works to save them.
The following paragraph was found in an article entitled How I Know I'm Going to Heaven:
I know that I'm going to Heaven because GOD is preserving me. I'm not preserving my own Salvation. I wasn't saved by my good works (Eph. 2:8-9; Rom. 4:5), so I do not STAY saved by my good works. I am KEPT by the POWER OF GOD, not by my own power! God is able to keep me from falling (Jude 24), because I'm HIS child and I'm in the palm of HIS hand (Jn. 10:28-29). Ephesians 4:30 says that I have been SEALED by the Holy Spirit of God until the day of redemption! I'm not worried about losing my Salvation. I KNOW I'm going to Heaven because I'm being preserved by God's power.
person is preaching a doctrine devoid of personal responsibility for
one's own salvation. This is contrary to everything we've seen in the
scriptures. As we've seen, you must hear the word of God, you must
believe the gospel that's preached to you, you must believe that Jesus
is the Son of God, you must repent of your sins, you must confess before
men your belief in Jesus as the Son of God, you must be baptized for the
remission of your sins, and you must remain faithful until death in
order to receive the crown of life from Jesus. Paul tells you to work
out your own salvation with fear and trembling, and Peter tells you to
make your calling and election sure. You have a great responsibility for
your own salvation. If you’re lost, it’s not God’s fault, it’s your own.
Some depend on emotion
I found the following at InTouch Ministries:
As I have said, I was saved at the age of twelve. I remember where I was sitting in the church. A woman was preaching, and I went forward and accepted Christ. So much emphasis was subsequently placed on performance, I wondered if I was still saved. But as I would get down beside my bed to pray, I would say, "God, I know I'm not doing everything right. But something inside me says I'm not lost."
This is a common doctrine in Christianity today. This person is basing the knowledge of his salvation on how he feels, not on what the word of God says.
This is a small sampling of the reasons people use to declare their salvation. I'm certain a more extensive review of the teachings found on the internet would reveal many more reasons. Just as people use invalid sources of information to know that they have what they need to fix a meal or to purchase something at a store, they use invalid sources of information to know they are saved. But there is only one valid way to know you’re saved: you must, with fear and trembling, carefully consider the teachings found in God's word and make sure you've obeyed them. Do you believe you are saved? Upon what are you basing your belief? Is it on the word of God or on the teachings of men?