Observing the six numbers on the RHS of the equalities:
The first equality, whose biggest number on the LHS is 1, has 1, 1, 1, 2, 1 and 1 as the six numbers.
The second equality, whose biggest number on the LHS is 2, has 2, 2, 1, 2, 2 and 1 as the six numbers.
The third equality, whose biggest number on the LHS is 3, has 3, 3, 1, 2, 3 and 1 as the six numbers.
The fourth equality, whose biggest number on the LHS is 4, has numbers 4, 4, 1, 2, 4 and 1 as the six numbers.
Note that the fourth number on the RHS is always 2 and the sixth number is always 1. The remaining numbers are equal to the biggest number on the LHS.
Hence, if the biggest number on the LHS is n, the six numbers on the RHS would be n, n, 1, 2, n and 1.
Using this property, we can calculate the sums for (i) and (ii) as follows:
.
(ii) The sum can be expressed as the difference of the two sums as follows:
The sum of the first bracket on the RHS:
The second bracket is:
Finally, the wanted sum is: