How to write an email to an academic asking for a summer research project?
Taking on an undergraduate for a short-term research project is, especially in theoretical and computational fields, essentially an act of service on the part of the professor.  By that I mean that usually the professor will put in much more than they get out of it.  This is because the student will usually need a significant amount of one-on-one tutoring, or at least time, to understand what needs to be done and learn the tools that will be used to do it.  That leaves little time (in a summer) for actually producing research results, and since it is likely the student's first project, progress is likely to be slow.

If the professor is at your own university and you have already established a connection and a good impression, then they may be willing to do it based on that.  The next best situation is to have a professor who knows you well recommend you to the professor at the other university.  But if you're cold contacting a professor who knows nothing about you, you need to demonstrate that 


You're in a good program and have excellent grades;
you have familiarized yourself with some part of their research (as well as you can with your current level of preparation);
You have good communication skills; and
You have some tools that are useful in the indicated field (e.g. substantial programming experience, experience with particular methods or techniques). 


All this needs to be in a short email (a long email probably won't get read at all).  Even the above quite often be enough.  Of course, if you are exceptional in some way then make sure to highlight that.  For instance:


You have some published research already
You won a major award (e.g. you placed in the top few worldwide in the IMO)
You did something else that shows you have aptitude for the field and includes a tangible, demonstrable result


The last one might be something like "I implemented computational method X in C and used it to solve this interesting problem; here is the code on Github and the results."