From Matthew 26:14-16:
Then one of the Twelve—the one called Judas Iscariot—went to the chief priests and asked, “What are you willing to give me if I deliver him over to you?” So they counted out for him thirty pieces of silver. From then on Judas watched for an opportunity to hand him over.
From Matthew 27:3:
When Judas, who had betrayed him, saw that Jesus was condemned, he was seized with remorse and returned the thirty pieces of silver to the chief priests and the elders.
Why was he filled with remorse only after he saw that Jesus had been condemned? He had evidently planned the betrayal out very carefully and well in advance, so why then? Given the fact that he seems to have known about the plot to kill Jesus, why does he seem surprised by this outcome?