Each school has a complicated formula to determine how much to weight various aspects of the application, and they're all very secretive about what that formula is

They'll announce each year what the average GPA and test scores were for that year's freshman class, but not a whole lot else. Things that get considered (in varying amounts depending on the school):
- grades
- test scores (SAT or ACT)
- extra-curricular activities such as sports, student clubs, volunteering, religious activities, music, etc.
- race and/or ethnic origin
- city/state the student is from
- 1-5 required essays on a variety of topics (proves the student can write & present an argument)
In addition, at least at the school I worked in the admissions office for, there were other considerations that sometimes came into play:
- sometimes an athletic coach would strongly encourage the admissions office to accept a student they wanted to recruit for their team (it still wasn't automatic, but those athletes got a bit more leeway about things like test scores)
- foreign students from non-English-speaking countries had to submit a TOEFL score (test of English as a foreign language)
- foreign students also had to demonstrate they were able to pay, since US financial aid mostly didn't apply for them (although my school did offer scholarships and financial aid to foreign students, which is very unusual)
- if the student had something truly outstanding on their resume (competed in the Olympics, made their first million by age 16, invented a new portable water filter that's now being rolled out in Africa, etc.)
- if the student's family was really, really rich and likely to have any buildings on campus named after them in the near future
- if two students are twins (or triplets), my school tried to lean toward not splitting them. So if one was great and one was kind of on the fence, they'd both get in - but if one was average and one wasn't that great, they'd both get rejected.
So they throw all that together, stick it in a formula, and come up with a freshman class list. This is entirely separate from whether the student's family could actually pay for college (at least for US students); the accepted list went on to the financial aid office and students applied separately for that.