Jesus is full of the Holy Spirit. The Holy Spirit knows everyone’s thoughts to the deepest crevices, the dark hidden places, thoughts that haunt our every moment, and the soul’s joy. So, Jesus knew the thoughts of those who came to him. Jesus knows every thought through the Spirit right now.
The jealous and fearful religious leaders were attempting to rationalize their objections to Jesus with the opinion that Jesus was driving out unclean spirits by Satan. They could not accept that Jesus had authority over all spirits because he was the Messiah and the Lord of Israel, the heavens, and all the earth. Jesus points out the ridiculous assumptions they made about the kingdom of Satan.
Jesus first tells the religious leaders and all who want to hear that Satan leads a kingdom. If Satan drove out those who followed him he would cause division that would turn into insurrection and civil war that would eventually end the kingdom of Satan. If Satan gave power to Jesus, who opposed him in every way, Satan would be supporting an attack on himself through his enemy.
Secondly, Jesus points out that some of their followers had driven out demons. Jesus did not say whether the followers of the Pharisees actually drove out demons, but they claimed to drive them out by the power of God, and Jesus claimed the same. So to accuse Jesus of using Satanic power was implicitly to condemn their own followers as well.
Jesus firmly states that he drives out demons with the finger of God. This is nothing for God Almighty. Jesus’ word is the finger of God.
