The basic way they add them up is with the weightings. SO if you have an assessment worth 25% and you get 80% for it then your mark is 80/100 x .25
and thats how much out of 25 goes toward your assessment mark.
Your ranking is worked out based on those internal marks.
So if you beat everyone in your class consistently for the year you should get a ranking of 1.
They do sometimes change them a bit at the end before their officially entered, teachers can change them but its very unusual for them to take marks away. My history teacher told us that if someone only gets 30 even though they've tried super hard then its acceptable for him to raise their mark up to 52. How ethical that is i'm not sure.
Then the HSC people can change it as well. For example, my Modern mark appeared on my report as 92 but because only 10% of people sitting any one subject can get a band 6, my assessment mark appeared on my HSC report as 90. By the same token, my General maths mark went from about 85 to 92.