How to calculate the charges of W and Z bosons? In the Standard Model, electroweak unification is based on the symmetry breaking of $ \text{SU(2)}\times \text{U(1)}_Y \rightarrow \text{U(1)}_{EM}$ by the VEV of a complex doublet $H$ with hypercharge $\frac{1}{2}$. 
The Lagrangian is
$$\mathcal{L}=-\frac{1}{4}(W^a_{\mu\nu})^2-\frac{1}{4}B^2_{\mu\nu}+(D_\mu H)^\dagger(D_\mu H)+m^2H^\dagger H-\lambda(H^\dagger H)^2,$$
where $W^a_\mu$ are the $\text{SU(2)}$ gauge bosons and $W^a_{\mu\nu}$ are given by $W^a_{\mu\nu}=\partial_\mu W^a_\nu-\partial_\nu W^a_\mu+gf^{abc}W^b_\mu W^c_\nu$, and $B_\mu$ is the $\text{U(1)}$ gauge bosons and $B_{\mu \nu}=\partial_\mu B_\nu-\partial_\nu B_\mu$.
The covariant derivative is
$$D_\mu H=\partial_{\mu}H-igW^a_\mu \tau^aH-\frac{1}{2}ig'B_\mu H.$$
After $H$ gets its VEV
$$H_0=\begin{pmatrix} 0 \\ \frac{v}{\sqrt{2}} \end{pmatrix},$$
the mass term of the gauge bosons comes from
$$(D_\mu H_0)^\dagger(D_\mu H_0)=\frac{v^2}{8}\left[ g^2(W^1_\mu)^2+g^2(W^2_\mu)^2+g'^2(g'B_\mu-gW^3_\mu)^2 \right].$$
My questions are why we define W bosons as $W^\pm_\mu=\frac{1}{\sqrt{2}}(W^1_\mu\mp iW^2_\mu)$ rather than just $W^1_\mu$ and $W^2_\mu$ respectively, and how to see the charges of $W^\pm$ and $Z$ bosons?
 A: The only thing You need is the explicit form of the electric charge generator $Q$, the only one "unbroken" by the Higgs VEV:
$$
Q = t_{3} + \frac{Y}{2},
$$
where $t_{3}$ is the weak isospin and $Y$ is the weak hypercharge. 
For $SU_{\text{L}}(2)$ bosons, namely, $W_{1},W_{2},W_{3}$, the weak hypercharge $Y$ is zero by the definition (note also that the hypercharge of $U_{Y}(1)$ gauge field, which is $B \sim g_{1}Z - g_{2}A$). 
In order to define the isospin $t_{3}$, we have to calculate the commutator
$$
\tag 1  [T_{3},T_{i}] = t_{3}T_{i},
$$
where $T_{3} \equiv \sigma_{3}$, with $\sigma_{3}$ being the Pauli matrix, is the isospin generator, while $T_{i}$ is the $SU_{\text{weak}}(2)$ generator associated with given boson. $(1)$ is the standard charge algebra.
From $W_{1},W_{2}, W_{3}$ bosons you can construct three states with given eigenvalues of isospin: $t_{3} = +1, t_{3} = -1, 0$. These states corresponds to generators
$$
\sigma_{+} = \frac{1}{2}\left(\sigma_{x} + i\sigma_{y}\right), \quad \sigma_{-} = \frac{1}{2}\left(\sigma_{x} - i\sigma_{y}\right), \quad \sigma_{0} = \sigma_{3}
$$
We have
$$
[T_{3},\sigma_{\pm}] = \pm \sigma_{\pm}, \quad [T_{3},\sigma_{3}] = 0
$$
Therefore, the combination $W_{1} - iW_{2}$ has the charge $Q = +1$, $W_{1}+iW_{2}$ has the charge $Q = -1$, and $W_{3} \sim g_{1}Z + g_{2}A$ has the charge $Q = 0$ (as well as $Z, A$ separately).
