Your teacher counts tests as 70% of the grade and homework as 30%. You score 60 on tests and 100 on homework. The plain average of 60 and 100 is 80, but that treats both parts as equally important. Weighted, the grade is 0.7(60)+0.3(100)=42+30=72. The result lands closer to 60, because the tests carry more of the weight.
That is all the formula says: multiply each value by its weight, add up the products, and divide by the total weight, not by how many values there are. When the weights are percents that add to 100% (or decimals that add to 1), the division changes nothing, which is why grade calculators often skip it. When the weights are counts, such as numbers of students or kilograms, the division is essential.
A plain mean is just a weighted average in which every weight is 1. The trap is averaging averages. If a class of 10 students averaged 90 on a test and a class of 30 averaged 70, the average of all 40 students is not 80. The larger class counts three times as much: 4010(90)+30(70)=403000=75. Whenever groups of different sizes are combined, the sizes are the weights.
Think of it like this. A weighted average is the balance point of a ruler loaded with stacks of coins: put a tall stack at 90 and a short one at 70 and the ruler balances nearer 90. Equal stacks balance exactly halfway. However the coins are arranged, the balance point can never fall outside the outermost stacks.
Core idea. Each value pulls the average toward itself in proportion to its weight, so the result is the sum of value times weight divided by the sum of the weights.