For certain effects, they should be designed so that you anticipate spectator guessing. Take ACRs. A common routine would be, put the card into the middle face down, and it pops to the top. Somewhat surprising, but people might think that it did not really go into the middle. So you cleanly put it into the middle, face down, and it pops to the top. Now they wonder whether it was actually the right card you put into the middle, so you put it in face up, and again it pops to the top. You would do this even if they say nothing. Whenever possible you should design tricks to handle the guesses, right or wrong.
As far as some of the advice here, what are the performance conditions when you do some of these? I would never ask someone to come forward and do the trick, unless I were 100% sure that my saying that would shut them up. I know Gazzo at times would interrupt a heckler and say to the crowd something like, "In all my years of performing, I have never seen someone with so much to say. So, sir, if you would you come forward, and I will take your place, and you can say anything you like for as long as you like and we will all wait. When you are done, I will go on with my show." Be warned, Gazzo is always sarcastic and he has boxed before and has decades of working on the streets. And he did not ask someone to do magic.
I don't get many hecklers, at least not rude ones, and I usually ignore it at first and just go on with the show, or make a quick comment like some have suggested here like, "Amazing piece of detective work there. Lets get together after the show and compare notes."
When dealing with a rude heckler you have to do something that is very, very, hard. You must never, ever, lose your cool or look nervous or weak. It is about body language. Raising your voice? Nervous, scared. Sounding tough? Scared. Ignoring the person (might work with minor hecklers)? can look weak.
You have to respond, but respond in a way that allows you to keep your show going. In other words, make sure that the lines fit the show and your character. It has to be witty, without being mean. It has to be quick, in control, and it has to get the rest of the audience on your side. If something quick doesn't work, you may have to stop and deal with it. As a tip, if you do not look worried, scared, upset, nervous, or weak, the heckler will eventually tire of it and leave. When I do a street show, psychologically, that show is my area. The heckler won't stay in that area if I show strength and calmness (and humor.) But even here, it requires that the other spectators be more interested in me than the heckler.
Don't expect this stuff to work as well at school. A heckler, specifically one who sees themselves as "cool" will feel that the school is theirs to do what they want and that you are imposing your show on their turf. They may not leave the area. You may not have the audience on your side. The audience may find the heckler more fun than you.
On the streets, a heckler can beat you in rare circumstances. It becomes very rare if you have more experience, and it does depend on when and where you perform. If you come off as a pro, people will generally be nicer.
Also, don't confuse angry, mean hecklers with those who just talk too much. Learn that often hecklers heckle because they have nothing to do. Give them something to do. I had one teenager who was a nice kid, but very hyper. He was constantly bending over trying to see under things, hopping around and acting goofy. I had to incorporate it into the show, or he would upstage me. I had him select cups, I put on my best "patient but aggrieved" teacher persona and had a great time. The adults in the crowd were sympathetic. I would patiently ask him to select a cup, commenting that he might need to breath into a paper sack first. When he shot forward to grab the cup (no, no, no) I viciously smacked the table as hard as I could and scared him back to the crowd. I gave one of those smiles that people give when they almost lost it and controlled themselves at the last second. He laughed and the audience laughed. For the rest of the routine, I showed my wand to him whenever I asked anything. He laughed; the crowd laughed; we had a great time. But I am an adult with decades of teaching experience, and he was a teenager. We knew our parts.