First of all, in America, private schools are the only schools that still utilize corporal punishment. In these schools, if corporal punishment is in fact effective, it because of a number of factors that exist more prevalently in private schools than in public schools.
Private schools tend to be smaller than public schools, therefore teachers and administrators are able to have (and do have) closer and more personal relationships with students and parents. A spanking delivered by someone the student respects and even loves is going to be more effective than a spanking coming from someone the student does not respect or simply does not know very well. The physical pain is temporary, but the effectiveness lies in the accompanying embarrassment or sense that the student has disappointed someone he or she respects.
Private schools also tend to have more parent involvement than public schools. In fact, in schools where corporal punishment is still allowed, it is an almost universal caveat that the parent must be present in the room when the spanking is delievered. Similarly, parents are often offered the option of doingthe spanking themselves instead of the school administrator. If spanking is something that has already been utilized as a method of punishment in the home, it is more likely to be effective in school as well.
Finally, corporal punishment might be effective as deterrent for bad behavior. Many students will avoid acting out in order to avoid being spanked. When the temptation to break a rule comes with a serious enough consequence, it is often enough to prevent students from breaking rules.