Quantising the Electromagnetic Field in QED 
How exactly do you derive this result?
 A: It is similar to how you derive a simple harmonic oscillators modes by diagonalizng a quadratic Hamiltonian in Quantum Mechanics (everyone remembers it, right?):
$$
H \propto \hat{X}^2+\hat{P}^2 \propto \hbar \omega (a^\dagger a+1/2)
$$ 
Here for photon fields, they are similar simple harmonic oscillators (SHO) you had learned in Quantum Mechanics.
But just: 
(1) change $a$ and $a^\dagger$ to $k$ dependence Fourier modes $a_k$ and $a_k^\dagger$. 
With a proper normalization (Lorentz invariant volume form: check Chap. 1 of Peskin and Schroeder "Intro to QFT") and spin-1 massless polarization (check Chap. 4,5 of Peskin and Schroeder "Intro to QFT"). 
(2) Check they are the solutions of free Maxwell equations from the Maxwell Lagrangian $$L  =\frac{1}{4} F_{\mu\nu}F^{\mu\nu} \propto \vec{E}^2-\vec{B}^2$$. Here $F=dA$. You can derive the EOMs.
A good exercise (for you?) is to write down the Hamiltonian by the canonical approach change 
$$L \to H = \dot{q} p-L(q, \dot{q})$$.
Find the conjugate momentum of $p$ from the $q$ ($q$ as $A(x,t)$ field). You will see explicitly why this Hamiltonian again has the quadratic form 
$$H \propto \vec{E}^2+\vec{B}^2 \propto \sum_k \hbar \omega_k (a_k^\dagger a_k+1/2)  .$$ 
That is why the quantization is exactly the SHO form you wrote in the question. ps. It is also a good review to compare it to the spin-0 scalar boson case. Check Chap. 1 of Peskin and Schroeder "Intro to QFT." 
If you ask more explicit result, you can also refer to the calculation here and Ref therein the bottom of that page. Hope it helps somehow. :-)
