Centralizer of symmetric group Let, an element of symmetric group $S_N$ is given by  $g=(1)^{N_1}(2)^{N_2}....(s)^{N_s}.$ Here $N_n$ denotes the number of cycles of length $n$. Its known that the centralizer of this element is given by 
\begin{equation}
C_g = S_{N_1} \times (S_{N_2} \rtimes \mathbb{Z}_2^{N_2}
) \times \dots\times (S_{N_s} \rtimes \mathbb{Z}_s^{N_s}
).\tag{1}
\end{equation}
I have been able to convince myself this formula gives the correct result when $g$ is the identity $(g=(1)^{N_N})$ and when $g$ is given by $g=(N)^1$.
However, lets take a simple case: let's try to find the centralizer of $(1,2)(3,4)$ in $S_4$. The answer is $C=\{Id, (1, 2)(3, 4), (1, 2), (3, 4), (1, 3)(2, 4), (1, 4)(2, 3), (1, 4, 2, 3), (1, 3, 2, 4)\}$.
I don't how I can construct this set using definition (1). 
Can anyone walk me through the process please? I tried to construct $\mathbb{Z}_2^2\rtimes S_2 $. This should be isomorphic to $D(4).$ Then I wrote down the elements of $D(4)$ in cycle notation but that didn't give me the correct answer.
 A: There is a standard way to construct the centralizer of a permutation $g\in S_N$ and following this construction we are able to find the formula $(1)$. The construction for a general $g$ is tedious, I try to write the algorithm and I will make the centralizer for $(1,2)(3,4)\in S_4$

Step $1$: Compute the cardinality of $C_g$.

$C_g$ is the stabilizer of $g$ by the conjugation action of $S_N$. It's easy to compute the cardinality of the orbit (it's just the cardinality of the conjugation class). Then we have:
$$
|C_g| = \dfrac{|S_N|}{|orb_{S_N}(g)|}
$$
In our case $g=(1,2)(3,4)$ and we have:
$$
|orb_{S_4}(g)| = \binom{4}{2}\dfrac{2!}{2}\cdot \binom{2}{2}\dfrac{2!}{2}\cdot \dfrac{1}{2!} = \dfrac{4!}{2\cdot 2}\cdot \dfrac{1}{2!}
$$
I write the cardinality of the orbit in this way because the last $\frac{1}{2!}$ represent the way you can choose the position of the transpositions that compose $g$ (you will see what I mean in Step $2$). Then we obtain:
$$
|C_g| = \dfrac{4!}{\dfrac{4!}{2\cdot 2}\cdot \dfrac{1}{2!}} = 2^2 \cdot 2!
$$
Again think that the first part and the second part are distinct: they represent in some sense $2$ different part of the centralizer.
If you use this method to calculate the cardinality of centralizer of a generic permutation $g = (1)^{N_1}\cdots (s)^{N_s}$ you will find the formula:
$$
C_g = 1^{N_1}\cdot 2^{N_2}\cdots s^{N_s} \cdot (N_1)!(N_2)!\cdots (N_s)! = 1^{N_1} (2^{N_2}(N_2)!)\cdot \ \cdots \ \cdot (s^{N_s}(N_s)!)
$$

Step $2$: Discover two important subgroups $H,K \subset C_g$ related to the computed cardinality.

We define the power subgroup $H$ of $C_g$ as the group generated by the powers of the cycles that forms the permutation $g$. It's easy to see that $H$ is a subgroup of $C_g$ and it's cardinality is
$$
|H| = 1^{N_1}\cdot 2^{N_2} \cdots s^{N_s}
$$
It's also easy to see that $H\cong \mathbb{Z_2}^{N_2}\times \cdots \times \mathbb{Z_s}^{N_s}$
In our case $g=(1,2)(3,4)$, then $H = \{e, (1,2), (3,4), (1,2)(3,4)\}\cong \mathbb{Z_2}^{2}$
Define the permutation subgroup $K$ as the set of permutations inside $C_g$ that "permutes by conjugation" the cycles of equal length. To understand what I mean I give you an example: let $\sigma=(1,2,3)(4,5,6)(7,8,9)$: an element of $K$ is (for example) $\alpha = (1,4)(2,5)(3,6)$ or $\beta = (1,7,4)(2,8,5)(3,9,6)$; in fact:
\begin{gather}
\alpha \sigma \alpha^{-1} = \alpha (1,2,3)(4,5,6)(7,8,9)\alpha^{-1} = (4,5,6)(1,2,3)(7,8,9) = \sigma\\
\beta \sigma \beta^{-1} = \beta (1,2,3)(4,5,6)(7,8,9)\beta^{-1} = (7,8,9)(1,2,3)(4,5,6) = \sigma\\
\end{gather}
So $\alpha$ and $\beta$ are element of $C_g$ and they permute the cycles of $\sigma$ when you acting by conjugation ($\alpha$ switches the first and the second cycle, $\beta$ move all three cycles). If you understand what is $K$ you are able to see that you can obtain by $K$ all the configuration of the cycles of the same length (in the example above, if you named $(1,2,3)=a, (4,5,6)=b, (7,8,9)=c$ then $\alpha$ is the "permutation" $(a,b)$ and $\beta$ is the "permutation" $(a,c,b)$). Finally we obtain $K\cong S_{N_1}\times S_{N_2}\times \cdots \times S_{N_s}$ where $S_{N_i}$ is isomorphic to the group that permutes che $N_i$-cycles of length $i$. Observe that $$|K|=(N_1)!\cdots (N_s)!$$
In our case $g=(1,2)(3,4)$, then $K = \{e, (1,3)(2,4)\}\cong S_2$.

Step $3$: $H\cap K = \{e\}$ and $H$ is normalized by $K$ (i.e. for all $k\in K$ $kHk^{-1} = H$)

This is the tedious part. If you have a permutation you can do the computation and you can easy prove the two statements: in our case it's obvious that the intersection is only the identity and up to few computation you discover that $K$ normalize $H$.
I give you just an idea for the general case. Consider $\sigma = (n)^{N_n}$ (after some simplification you have to study only this case: you consider the problem restricted on the numbers inside the cycles of length $n$). Denote the cycles of $\sigma$ as $a_1,...,a_{N_n}$ and consider the action of $C_g$ over the set of this cycles. You can show that $H$ is the kernel of this action and that every element of $K \backslash \{e\}$ is not mapped to zero. Then you obtain the two statements of this Step.

Step $4$: Conclude that $C_g \cong H\rtimes K$

Since $H\cap K = \{e\}$, $|H|\cdot|K| = |C_g|$ and $H$ is normalized by $K$ you obtain that $C_g \cong H\rtimes K$. After the same semplification mentioned in Step 3 you obtain the formula $(1)$.
In our case we have $C_g \cong H\rtimes K = \mathbb{Z_2}^2\rtimes S_2$ and if you try to list all the elements you obtain exactly $C$ you wrote in your question.
