We cannot look into the heart of someone to determine whether or not he is saved, but there are two things we can examine: profession and actions.
First of all, the person who would confess the basic Biblical doctrines of Christianity such as the Trinity, the deity of Christ, his physical resurrection, justification by grace of faith, etc., is affirming the necessary elements that must be held by faith to be Christian. But, if someone denies that Jesus Christ was raised from the dead physically or denies justification by grace and faith in Christ alone and other such essential Christian doctrines and refuses to affirm Biblical truth even after proper teaching, then we can safely say that such a person is not saved. Take for example what Jesus said in John 8:24, "unless you believe that I am, you will die in your sins." Jesus was claiming divinity as is later evidenced by Him using the divine name of God "I AM" in John 8:58 (see Exodus 3:14). The deity of Christ (that He is God in flesh, Col. 2:9) is a necessary doctrine in the Christian faith. So, if someone were to deny openly such an essential doctrine, we could say that the person is not saved.
Second, a person’s actions need to be examined to see if they're consistent with his profession. 1 John 2:4 says, “If you say you know him and do not keep his Commandments, the truth is not in you and you are a liar.” So, if someone professes to be a Christian and yet behaves in a manner contrary to that profession, then we would naturally doubt his salvation.
So, let's say that someone is confessing Christ as Savior but is openly and unrepentantly involved in an adulterous relationship. Such lack of conviction of sin and lack of struggle against it is a strong indication that the person does not have the Spirit of God within him. It would be evidence that such a person is not saved.
Finally, we must be very careful not to be too judgmental too quickly. It is a serious thing to say that someone is or is not saved. If you are unsure about the salvation of someone, then you should pray for that person, ask God to work in a person's life, and ask the Lord to give you wisdom.