Recently (early 2018) I had the fortunate problem of choosing an overseas summer student (in the UTSIP program). Not so long ago, I was on the other side of such choices, and it would have helped me to know how they are made.
First of all: when you become a professor, it's not like anyone teaches you important things like how to interpret resumes or select students. I'm just feeling my way here.
Anyway, I was presented with a website where someone had efficiently tabulated ~30 applicants who had chosen me as their first choice supervisor. So many! I had feared it would be none. I didn't even bother looking at the 2nd and 3rd choices.
After getting familiar with this table, I ended up prioritizing one column: GPA (grade point average). I think this may have a standard meaning in the USA, but doesn't exist in other countries. Nevertheless, they somehow extracted a "GPA" from each candidate, and presented it as a score out of 100. Some seemed really high (90s), which definitely impressed me. I looked into the documents submitted by these candidates, which included transcripts of per-course grades. Some candidates had near-perfect grades in all their courses: I took this as a very good sign that they reliably excel.
The next thing I looked at is the name of your university. If it's world-famous (Stanford, Cambridge) and your grades are excellent, then I'm really impressed. If you're at IIT or Beijing University, I'm even more impressed, considering the competition. But the Stanbridges have a slight edge, because I guess they're better connected to the research frontier. In rare cases, I might happen to know that your department is world-leading even though the university is not quite so famous. If you're at a university I've never heard of in Pakistan, I'm open minded, because I've never heard of any universities in Pakistan: if your grades are impressive, I'll do some web research on the university.
Some candidates had prior research experience, sometimes in topics close to mine, even with researchers that I've heard of and respect. This is a massive plus.
I also looked at recommendation letters: I would say this is important, but actually they were bland. A few candidates didn't have any recommendation letter, which worried me. The absolute worst is to get someone with personality issues who disrupts the working environment for everyone around them. I'd much rather get someone nice but dim. A recommendation letter is no guarantee of course, but at least it means someone vouches for you.
The candidates also supplied some personal statement about why they wanted to do a research internship. It's important for this to be reasonably coherent and sensible, but I don't care apart from that.
As a tie-breaker issue, I looked for evidence of computer-wrangling experience. For me, computers are mainly a means to an end, but it's great if you can hit the ground running in extracting information from messy datasets. Python, unix command line: great. Perl: acceptable. C/C++: overkill (but impressive). R: if that's your main language, I fear you'll be limited.
As another minor tie-breaker, some applicants had learned a bit of Japanese. This suggests you're serious about coming here and making the most of it.
I also got a photo of each candidate. This bothers me: I can't see any relevance to their qualifications, and it smells of prejudice. I believe it didn't affect my choice.
Finally, I favored applicants who seemed genuinely interested to come here, maybe also for graduate studies. One of our main motivations is to recruit excellent graduate students.
Many of the candidates seemed really nice and solid: I'd love to accept them. Three seemed intimidatingly world-class. And I could only take one.
Summary: it's purely a competition. Grades are important (not because they're really important, but because they're all I have to go on). Previous, related research experience is a big plus. Later-stage undergraduates with more experience are favored. Shamelessly pester your recommenders until they actually send a letter. Give specific instructions: I need the letter by this date sent to here. (Sometimes people ask me for a recommendation: I'll say "yeah sure", but I won't do anything till I get specific instructions.) Knowing the right people is a huge bonus: one motivation for me is to make connections with other research groups. What, you thought this was "fair"?
I don't know if other professors choose students in the same way. This example suggests not (though it's about PhD application, which is a bit different).