I wanted to know if you could tell me why in some incidents in the Bible demons are rebuked and other times they are casted out?

In every verse that I could find involving a person possessed of a demon, the demon was casted out (or it might say that the person was healed of demon possession). Examples are: Matthew 4:24; 8:16; 31-32; 9:33; 12:18; 15:22, 28; Mark 1:34, 39; 7:26, 29; 16:9, etc.

There are only four cases where Jesus is said to have rebuke a demon prior to casting him out. "Now in the synagogue there was a man who had a spirit of an unclean demon. And he cried out with a loud voice, saying, "Let us alone! What have we to do with You, Jesus of Nazareth? Did You come to destroy us? I know who You are--the Holy One of God!" But Jesus rebuked him, saying, "Be quiet, and come out of him!" And when the demon had thrown him in their midst, it came out of him and did not hurt him" (Luke 4:33-35).

To understand what is happening, suppose a man, convicted of bank fraud what to speak at your trial to tell everyone what an honest man you are. Most of us would decline. The fraud's own reputation ruins the credibility of his witness. Much the same happened here. Jesus did not want the testimony of a demon on his behalf. Thus he rebuked the demon, that is, told him to be quiet before casting the demon out of the man. Paul did much the same to a demon possessed woman in Acts 16:17-18.

Luke 4:41 tells us that this happened many times. Jesus did not want the testimony from this particular source, nor was it time for that awareness to be proclaimed. So he rebuked the demons and kept them quiet.

In two other cases, the same happens, but we are not told why, just that Jesus rebuked the demon and then casted them out (Matthew 17:18 and Luke 9:42). Because of the other accounts we can assume that the reason remained the same. Jesus did not want the demons testimony so he rebuked them to keep them quiet and then casted them out.

See also:

Questions and Answers regarding Demons
Questions and Answers regarding Miracles