How do they calculate the A level grade?

Edexcel answer:
Each paper out of 75 is turned into a score out of 100 using a lookup table that is different for each paper.
The score out of 100 has boundaries 80% A, 70% B etc.
The total for 3 modules at AS or 6 modules for A Level is used to find the overall grade for the subject.
e.g.
AS Maths C1 82% C2 42% M1 65%
Total 189 Average 63% = C grade overall

Actually, rather than an "average" (by which I think you mean the arithmetic mean), they use a UMS total to determine overall grade.

So, for AS, the UMS required out of 300 are: E-120; D-150; C-180; B-210; A-240. Double these for A2.

I concede that, in practical terms, it makes no difference whether you use total or arithmetic mean, but I always explained it to students by using total UMS. By the way, this method is used by ALL exam boards for ALL AS and A2 courses (as far as I am aware).

How they gwet the UMS scores is an arcane branch of alchemy which involves sheeps' entrails, quicksilver and what percentage pass rates the government want this year...

Surely it would be easier just to say: "UMS of 540 = A at A-level." rather than all this deciding which modules are more or less important?

So, for your straight A-level student, the message is: "Make sure your C3 and C4 are top notch, you can let the M1/S1/D1 you do in Year 13 slide a bit, because nobody cares what you get in that, as long as you get those 90+ in C3 and C4." After all, score of C3-91; C4-92; Applied Module-57 would be good enough for an A*, wouldn't they?