"In the moment when I truly understand my enemy, understand him well enough to defeat him, then in that very moment I also love him. I think it's impossible to really understand somebody, what they want, what they believe, and not love them the way they love themselves."

Ender is telling Valentine why he hates himself. He is able to understand his enemies better than anyone else, but once he understands them he destroys them. With such tremendous empathy, even in coming to understand his worst enemies Ender loves them. This means that when he crushes them he is hurting himself in the process. Ender does not want to have enemies, so that he will not be forced to hurt anybody. He will love even those who seem to be his most bitter enemies when he properly understands them. But in the situations Ender has been in he has no choice other than destroying those enemies. At the end of the book, when Ender comes to truly understand the buggers, he is able to try to help them. He has already done them great harm, but now he can be happy because he has a chance to undo what he did to them.