How to solve a specific complex integral: $\int_M \frac{(6z+1)^5 \cos(3z+1)}{(3z+1)^2}dz$ In a test today, we were given a specific integral to solve: for a curve $M$ oriented clockwise, being a rectangle with vertices $(1,2), (-1,2), (-1,-1), (1,-1)$,
$$\int_M \frac{(6z+1)^5 \cos(3z+1)}{(3z+1)^2}dz$$
We were not actually taught how to solve integrals of this form at this point - which was a bit eyebrow-raising for a bunch of us. The professor said it was more of a test of confidence ... or something. Either way a little weird to put on a test, but okay. 
So, my question is, how would one solve it?

My Attempt: 

Post-script from a month after I posted this: this approach did touch on the correction but was wrong. The substitution was a big reason why.

Very recently, we discussed expressing complex functions as a power series. If we try to express the function $f(z)$ as a power series about $z = 0$, 
$$f(z) = \sum_{n=0}^{\infty} a_n z^n$$
then each coefficient $a_n$ is given by either of the below,
$$a_n = \frac{-1}{2\pi i} \int_{M} \frac{f(\zeta)}{\zeta^{n+1}} d \zeta = \frac{1}{n!} f^{n}(0)$$
(The negative comes from $M$ being oriented clockwise.)
Well, if we make the substitution $\zeta = 3z+1$ in our original integral (yielding $d\zeta = 3dz$), we have
$$\int_M \frac{(6z+1)^5 \cos(3z+1)}{(3z+1)^2}dz= \frac{1}{3} \int_M \frac{(2\zeta-1)^5 \cos(\zeta)}{\zeta^2}d\zeta$$
If we let $f(\zeta)$ be given by $f(\zeta) = (2\zeta-1)^5 \cos(\zeta)$, we then essentially match the form of the integral in the definition of the coefficients above if $n=1$, i.e.
$$a_2 = \frac{-1}{2\pi i}  \int_M \frac{f(\zeta)}{\zeta^2}d\zeta = \frac{-1}{2\pi i} \int_M \frac{(2\zeta-1)^5 \cos(\zeta)}{\zeta^2}d\zeta  = \frac{1}{1!} f^{1}(0)$$
or, essentially,
$$\int_M \frac{f(\zeta)}{\zeta^2}d\zeta = \int_M \frac{(2\zeta-1)^5 \cos(\zeta)}{\zeta^2}d\zeta  = -2 \pi i \cdot f'(0)$$
Would this be right so far?
From here, it's basically arithmetic: find the derivative of $f(\zeta)$, evaluate it for $\zeta = 0$, and multiply by $\frac{1}{3}$ to return to the integral we got by the substitution $\zeta = 3z+1$= and $d\zeta = 3dz$.
I'm not going to bore you with that arithmetic, I'm more concerned with just the overarching idea of how to solve this integral, as opposed to the actual answer, since I'm not sure if I have the right idea. 
Actually I feel pretty sure I don't, but I couldn't think of anything else that would apply.
 A: 
Disclosure: Saw that this question was open after learning the proper way to do it. Since an answer beyond "use the residue theorem" wasn't used, I figured I'd answer my own question. And on top of that, use the residue theorem I learned, as well as showing how it implies the solution I was intended to use (the relation you derive from using power series).


With regards to the method in the OP, this is very incorrect. The solution itself is best done with the residue theorem, which subsumes all prior activity in the course I was taking: Cauchy's integral formula, Cauchy's integral theorem, etc., ultimately were all implications of the residue theorem.
So it's best to tackle it from that mindset.

Solution:
So let's begin with our integral on the clockwise rectangle $M$:
$$\int_M \frac{(6z+1)^5 \cos(3z+1)}{(3z+1)^2}dz$$
We factor out $1/3$ from the denominator twice, thus noting
$$\int_M \frac{(6z+1)^5 \cos(3z+1)}{(3z+1)^2}dz = \frac{1}{9} \int_M \frac{(6z+1)^5 \cos(3z+1)}{(z+1/3)^2}dz$$
The one and only pole for this integrand is $z=-1/3$ and it is of order $2$. Thus, we can claim
$$\begin{align}
&\frac{1}{9} \int_M \frac{(6z+1)^5 \cos(3z+1)}{(z+1/3)^2}dz \\
&= \frac{1}{9} \cdot (-2\pi i )\cdot \frac{1}{(2-1)!} \cdot \left. \frac{d^{2-1}}{dz^{2-1}} (z+1/3)^2 \frac{(6z+1)^5 \cos(3z+1)}{(z+1/3)^2} \right|_{z=(-1/3)}
\end{align}$$
We clean up a bit and see
$$\frac{1}{9} \int_M \frac{(6z+1)^5 \cos(3z+1)}{(z+1/3)^2}dz = \frac{-2\pi i}{9} \left. \frac{d}{dz} (6z+1)^5 \cos(3z+1) \right|_{z=(-1/3)}$$

Digression: Residue Theorem vs. Power Series Method:
A slight digression on how the solution thus far, using the residue theorem, basically implies an approach under what I was expected to do (the whole power series relation thing).
Let $f(z) = (6z+1)^5 \cos(3z+1)$, i.e. the numerator of our integrand. Then from the power series, we know
$$\int_M \frac{f(z)}{(z- (-1/3))^2} dz = \frac{-2\pi i}{(2-1)!} f^{(2-1)}(-1/3)$$
and more generally, for counterclockwise closed curves $C$,
$$\int_C \frac{f(z)}{(z-z_0)^k} dz = \frac{2\pi i}{(k-1)!} f^{(k-1)}(z_0)$$
Equivalently, as it was introduced in my class,
$$\int_C \frac{f(z)}{(z-z_0)^{k+1}} dz = \frac{2\pi i}{k!} f^{(k)}(z_0)$$

Solution: Part 2: (a.k.a. boring arithmetic)
So we find
$$\left. \frac{d}{dz} (6z+1)^5 \cos(3z+1) \right|_{z=(-1/3)}$$
We use the product rule and thus
$$\begin{align}
&\left. \frac{d}{dz} (6z+1)^5 \cos(3z+1) \right|_{z=(-1/3)} \\
&= \left. (5)(6)(6z+1)^4 \cos(3z+1) + (-3)(6z+1)^5 \sin(3z+1) \right|_{z=(-1/3)}
\end{align}$$
Simplifying, we obtain
$$\left. 30(6z+1)^4 \cos(3z+1) -3(6z+1)^5 \sin(3z+1) \right|_{z=(-1/3)} = 30$$
Thus,
$$\frac{1}{9} \int_M \frac{(6z+1)^5 \cos(3z+1)}{(z+1/3)^2}dz = \frac{-2\pi i}{9} \cdot 30 = \frac{-20 \pi i}{3}$$
