Who gets the slots available in a course is dictated by the students' results in the final exams in high school. (This is approximately true: in NSW several exams before the end of high school also count. Some universities will offer places based on the "other" high school exams if they can predict what your final exam result will be with sufficient accuracy.)
The student with the highest marks gets the place they want, and then the next student down gets their first preference, unless it is full, in which case they get their second, third, fourth, preference. And so on down through all the student candidature.
Theoretically this whole system should let a sufficiently capable average income student study humanities (or whatever they want).
In practice there are problems -- some schools have teachers who are very good at getting good marks for their students in the final exam; actually being intelligent and creative doesn't really help as much as it should -- but it's not an overly terrible system.