Anyway, answering the thread's question.
Moderation of Marks -
1. The person who came first in the External Exam will take the External Mark of the person who came first in the Internal Assessment.
2. The person who came last in the External Exam will SOMETIMES take the External Mark of the person who came last in the Internal Assessment. This isn't always the case, because if the last ranked person in the Internal Assessment scored really badly in the External Exam, then it would screw this person's marks up. They have a means of compensating for dodgy/outlier marks, usually through scaling.
3. All the above is done to produce a 'skeleton' or an 'outline' of the marks achieved by that particular Cohort.
The reason why they do this with the marks is because some schools give really easy assessments/mark easy and some schools give really hard assessments/mark harshly and to make it fair for everyone, they will moderate your internal mark up/down, depending on how well you did in your external exam. This makes sure that each student gets what they really deserved for the Internal Assessment Mark.
Scaling of Marks -
1. Depending on how your own class and NSW did in that particular subject, you will be scaled up/down/not change much based on how well you did, in relation to them.
2. The reason why subjects like Maths Extension 2, Physics, Chemistry and Distinction courses (like Philosophy) have 'high scaling' is because, 1. It actually is quite hard to score a good mark in that subject, because they are difficult subjects and 2. Generally speaking, there are higher numbers of 'more-abled' students who score really well in these subjects and as a result, allows other students (and themselves) to have higher scaled marks, than in comparison to the scaled marks you get in Music, Drama, Food Tech, etc.
One the Internal Assessment Mark and the External Assessment Mark is moderated and scaled, they take the average of these two marks to produce your final HSC Mark. Your HSC Mark is the mark you should really look at.
When calculating your ATAR, they will look at your HSC Mark, as well as your Raw HSC Marks to see where you stand, in comparison to the rest of NSW.
Hope that answers your query.
Sorry that was uber long.. Like a few other members have said, it is quite a difficult concept to grasp at first, but towards the end of your HSC, you should have a fairly good grip on how the whole HSC/ATAR thing works.
Good luck with your studies and stuff
P.S: Consistency is the key to doing well in the HSC.