Let $G$ be a finite cyclic group, $M$ be a $G$-module, $M^G=\{m\in M: \sigma(m)=m\}$ and the trace map $T: M\longrightarrow M$ as $T(m)=\sum_{j=0}^{n-1}\sigma^jm$, then $H^2(G,M)\cong M^G/\text{Im}(T)$.
My only problem is to show that surjectivity, that is, we need to show that for any 2-cocycle $f$, define $m=\sum_{j=0}^{n-1}f(\sigma^j,\sigma)$, then $f-f_m\in B^2(G,M)$, where $f_m$ is the 2-cocycle defined through $m$. Notice that $m\in m^G$.
I do not know how to compute $f-f_m$ nicely? Since $f_m$ does not have a good formula, but a point-wise definition.
Suppose that $G$ is finite cyclic of order $n$ and $\sigma$ is a generator. Consider the elements $\sigma' = 1-\sigma$ and $\eta = 1+\sigma+\cdots+\sigma^{n-1}$, which induce maps $\mathbb ZG\to\mathbb ZG$ by multiplication. Note (or prove) that
$\ker(\sigma'\cdot -) = \text{im}(\eta\cdot -)$
$\text{im}(\sigma'\cdot -) = \ker(\eta\cdot -)$.
$\text{coker}(\sigma')$ is the trivial $\mathbb ZG$-module $\mathbb Z$.
All this means the following is a free resolution of the trivial $\mathbb ZG$-module $\mathbb Z$:
$$\mathcal Q:\cdots\longrightarrow\mathbb ZG\stackrel{\eta}\longrightarrow \mathbb ZG \stackrel{\sigma'}\longrightarrow \mathbb ZG\stackrel{\eta}\longrightarrow \mathbb ZG\stackrel{\sigma'}\longrightarrow \mathbb ZG $$ This gives what you want, and in fact a complete description of all cohomology groups $H^p(M,G)$.
Add To see how the above helps with your question, note that taking $\hom_G(-,M)$ against the portion of the resolution $\mathbb Z G\stackrel{\eta}\to\mathbb Z G\stackrel{1-\sigma}\to \mathbb ZG$ and identifying $\hom_G(G,M)=M$ you get that $H^2(G,M)$ is isomorphic to the homology of
$$M\stackrel{\eta}\to M\stackrel{1-\sigma}\to M$$
at the middle. The kernel of $1-\sigma$ is certainly $M^G$, and $\eta$ is precisely your trace map. To solve your problem about $2$-cocycles, you want to find a comparison map from $\mathcal Q$ to the usual resolution you use to compute group homology. These maps will tell you exactly what $f$ to choose to make $f-f_m$ a boundary.