Virtually every believer will experience doubts about the reality of his salvation at some point. There are a variety of reasons for that doubt and lack of assurance: repeated sinful activity, ongoing temptation, or lack of discipline in spiritual essentials like prayer, Bible intake, and evangelism.
Don Whitney also points out that another reason for assurance might be one’s overly scrupulous examination of spiritual fruit, and the conclusion that because one isn’t perfect, he must not be saved (these may be the three most helpful paragraphs in the book):
Beware of unreasonable self-condemnation.…Because they aren’t perfectly obedient to God’s Word, completely loathing of the world, infallibly loving of other Christians, etc., [some] are reluctant to receive assurance. Like those trying to attain salvation by works, they can always find another rung to climb before they reach the top of the ladder of assurance. No matter what they do, they always look for more to do before they will believe that they are Christians. When they look into the mirror of God’s Word, particularly in 1 John, they only look for what is wrong with their evidences rather than what is right. They dwell on what is lacking rather than on what is present.
But the Bible requires only the presence of evidences, not the perfection of them. The flowers of evidence in the bud are flowers nonetheless. And though they are not fully mature, the desire for them to be so (and the grief that they are not) are blossoms formed only by faith in Christ. The Holy Spirit first changes our affections and then effects changes in our actions. If your heart is drawn toward the characteristics of Christians we’ve seen in 1 John and you want to see them formed in you, then believe that God is at work in you.
Concern about your inability to live up to God’s standards is also a good sign. Those who don’t experience some discouragement about their failures in discipleship are either unconverted or live unexamined lives. In that sense your discouragement itself may be another assuring sign of spiritual life.…Let that discouragement also be a reminder that you are not saved by what you are supposed to do but rather by trusting in Christ.…Don’t be so stringent and ruthless in your self-examination that you lose sight of the Cross and the power of Jesus to save sinners. [Donald Whitney, How Can I Be Sure I’m a Christian?]