Why would Annas begin by asking Jesus about His disciples and His teachings? It seems unlikely that Annas would inquire about these things for the sake of information, since such matters were commonly known (as Jesus Himself affirmed in His reply) and since the religious leaders had been monitoring Him closely for quite awhile trying to find a way to destroy Him. They were very familiar with both His disciples and His teachings. Annas is digging for something--anything--that they can use to frame an accusation against Jesus. He evidently hopes to lead Jesus into disclosing some act or teaching that was not known publicly that would incriminate Him.
"I spoke openly to the world. I always taught in synagogues and in the temple, where the Jews always meet, and in secret I have said nothing" - Jesus desired to keep His disciples free of any charges, so He only responded pertaining to the doctrine He taught. His preaching, from the beginning, had been public and open to all.
There are many occasions in which Jesus said things "in secret" (e.g., just to His disciples, cf. Matt. 13:10,11), but these matters were generally elaborations upon things taught publicly, not new or different doctrines. Jesus didn't teach anything in secret for the purpose of concealment (cf. Matt. 10:27).
"Why do you ask Me? Ask those who have heard Me what I said to them. Indeed they know what I said" - If Annas really wanted to know about Jesus' doctrine, he simply had to ask those who had heard Him. The very officers who had arrested Jesus could speak of these matters (cf. John 7:45,46).
Jesus' question and comment in John 18:21 must have been interpreted as a challenge to the proceedings of this inquisition. It was completely improper for Jesus to be arrested without charges being made against Him, charges that could be supported by witnesses. Jesus would not "incriminate" Himself (as they were evidently hoping for). He told them they could easily acquire their information elsewhere. This response angered an officer (and probably most of those who were present). He struck Jesus across the face with his hand to humiliate Him.
"If I have spoken evil, bear witness of the evil; but if well, why do you strike Me?" - Jesus calmly rebuked the officer and told him that his actions were out of line. If Jesus had spoken words deserving of punishment, then the officer should have sought such in a legal manner (not by taking authority into his own hands). If Jesus' words were appropriate, then the officer is doubly wrong in striking Him--wrong to punish Jesus who had done nothing improper and wrong to strike Him without authority! Jesus does not seek rectification for Himself, but He does insist that the laws of justice be followed. Sadly, His words have fallen upon deaf ears.
Jesus here exemplifies His teaching in Matthew 5:39 where He said - "But I tell you not to resist an evil person. But whoever slaps you on your right cheek, turn the other to him also." Our Lord does not resist, but neither does He refrain from using His tongue to rebuke and defend Himself (cf. Acts 23:1-3). It is acceptable to protest illegal and unjust actions.