You sit an exam, score a mark, say 70, lets say in extension 1 maths.
Since the average for ext1 is fairly low compared to other subjects, ext1 'aligns' up, giving you a mark of say 85. This is what is on your HSC document.
The UAC centre then takes these HSC marks, and 'scales' them according to the relative difficulty of a subject (depending on how well the students did in the state overall) to give you a mark, say 90.
They then reduce this down to a base of 'out of 50', i.e. 90/100 becomes 40/50 (1 unit). They take the best 10 units, add them to an aggregate out of 500, put everyones aggregate in a big list - and slap ATARs next to them.
That's ish it, I might be wrong in a couple of places (and that is simplified - ignoring assessment marks)