Hello Katie,
One way we could find these sums is the expand the summands, and then rely on the following formulas:
(1) $$\sum_{k=1}^{n}(1)=n$$
(2) $$\sum_{k=1}^{n}(k)=\frac{n(n+1)}{2}$$
(3) $$\sum_{k=1}^{n}\left(k^2 \right)=\frac{n(n+1)(2n+1)}{6}$$
Also, we will use the following linearity properties of sums:
(4) $$\sum_{k=k_i}^{k_f}\left(a\cdot f(k) \right)=a\cdot\sum_{k=k_i}^{k_f}\left(f(k) \right)$$
(5) $$\sum_{k=k_i}^{k_f}\left(f(k)\pm g(k) \right)=\sum_{k=k_i}^{k_f}\left(f(k) \right)\pm\sum_{k=k_i}^{k_f}\left(g(k) \right)$$
Now, the first sum can be expanded as follows:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=\sum_{k=1}^{n}\left(2k^2+3k+1 \right)$$
Using (5), we may write:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=\sum_{k=1}^{n}\left(2k^2 \right)+\sum_{k=1}^{n}(3k)+\sum_{k=1}^{n}(1)$$
Using (4), we may write:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=2\sum_{k=1}^{n}\left(k^2 \right)+3\sum_{k=1}^{n}(k)+\sum_{k=1}^{n}(1)$$
Using (1)-(3), we may write:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=2\left(\frac{n(n+1)(2n+1)}{6} \right)+3\left(\frac{n(n+1)}{2} \right)+(n)$$
Combine terms:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=\frac{2n(n+1)(2n+1)+9n(n+1)+6n}{6}$$
Factor numerator:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=\frac{n\left(2(n+1)(2n+1)+9(n+1)+6 \right)}{6}$$
Expand within second factor of numerator:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=\frac{n\left(4n^2+6n+2+9n+9+6 \right)}{6}$$
Collect like terms:
$$\sum_{k=1}^{n}\left((k+1)(2k+1) \right)=\frac{n\left(4n^2+15n+17 \right)}{6}$$
Now for the second sum (and following the same steps as for the first sum):
$$\sum_{k=1}^{n}\left((3k+1)^2 \right)=9\sum_{k=1}^{n}\left(k^2 \right)+6\sum_{k=1}^{n}(k)+\sum_{k=1}^{n}(1)$$
$$\sum_{k=1}^{n}\left((3k+1)^2 \right)=9\left(\frac{n(n+1)(2n+1)}{6} \right)+6\left(\frac{n(n+1)}{2} \right)+(n)$$
$$\sum_{k=1}^{n}\left((3k+1)^2 \right)=\frac{3n(n+1)(2n+1)+6n(n+1)+2n}{2}$$
$$\sum_{k=1}^{n}\left((3k+1)^2 \right)=\frac{n\left(6n^2+9n+3+6n+6+2 \right)}{2}$$
$$\sum_{k=1}^{n}\left((3k+1)^2 \right)=\frac{n\left(6n^2+15n+11 \right)}{2}$$
Another way we could find these sums is to treat them as linear inhomogenous difference equations:
$$S_{n}-S_{n-1}=an^2+bn+c$$ where $$S_1=a+b+c$$
Now, observing that the corresponding homogeneous equation has the characteristic root $r=1$, we know the homogenous solution is:
$$h_n=c_1$$
And bearing in mind that none of the terms in the particular solution can be a solution to the homogenous equation, we then take for the particular solution the form:
$$p_n=An^3+Bn^2+Cn$$
Now we may use the method of undetermined coefficients to determing the values of the parameters $A,B,C$.
Substituting the particular solution into the difference equation, we obtain:
$$\left(An^3+Bn^2+Cn \right)-\left(A(n-1)^3+B(n-1)^2+C(n-1) \right)=an^2+bn+c$$
Expanding and collecting like terms, we get
$$3An^2+(-3A+2B)n+(A-B+C)=an^2+bn+c$$
Equating like coefficients, we obtain the linear system:
$$3A=a\implies A=\frac{a}{3}$$
$$-3A+2B=b\implies B=\frac{a+b}{2}$$
$$A-B+C=c\implies C=\frac{a+3b+6c}{6}$$
And so our particular solution is:
$$p_n=\frac{a}{3}n^3+\frac{a+b}{2}n^2+\frac{a+3b+6c}{6}n$$
Combining terms, we obtain:
$$p_n=\frac{n\left(2an^2+3(a+b)n+(a+3b+6c) \right)}{6}$$
Thus, by the principle of superposition, we find the general solution is:
$$S_n=h_n+p_n=c_1+\frac{n\left(2an^2+3(a+b)n+(a+3b+6c) \right)}{6}$$
Now, using the initial value, we may determine the parameter $c_1$:
$$S_1=c_1+\frac{2a+3(a+b)+(a+3b+6c)}{6}=a+b+c$$
$$c_1=a+b+c-\frac{6a+6b+6c}{6}=0$$
Thus, the general solution satisfying the given conditions is:
$$S_n=\frac{n\left(2an^2+3(a+b)n+(a+3b+6c) \right)}{6}$$
Now, for the first problem, we identify:
$$a=2,\,b=3,\,c=1$$
Hence:
$$S_n=\frac{n\left(4n^2+15n+17 \right)}{6}$$
And for the second problem, we identify:
$$a=9,\,b=6,\,c=1$$
Hence:
$$S_n=\frac{n\left(18n^2+45n+33 \right)}{6}=\frac{n\left(6n^2+15n+11 \right)}{2}$$