If you understand the case of equal weights, the general case following by a simple trick. I'll do your example of maximizing $q_1^2 q_2$ for $q_1+q_2=1$.
Set $(r_1, r_2, r_3) = (q_1/2, q_1/2, q_2)$. Then our goal is to maximize $r_1 r_2 r_3$ subject to the side constraints $r_1+r_2+r_3=1$ and $r_1=r_2$. By the equal weights case, the maximum of $r_1 r_2 r_3$ given the first constraint is achieved at $(1/3, 1/3, 1/3)$. Since $r_1 = r_2$ at this point, the second constraint does not effectaffect the answer.
This trick let'slets you deduce the case of any rational weights from the equal weights case, and then the case of real weights follows by continuity.