Canonical quantization promotes the classical Klein-Gordon field and its conjugate momentum to operators satisfying equal-time commutation relations. The field decomposes into a sum over momentum modes, each a quantum harmonic oscillator, with creation and annihilation operators that create and destroy particles.
The Klein-Gordon equation (partial_mu partial^mu + m^2)phi = 0 describes a free relativistic scalar field. As a classical field equation, it is the Euler-Lagrange equation for the Lagrangian density L = (1/2)(partial_mu phi)(partial^mu phi) - (1/2)m^2 phi^2. Canonical quantization promotes this classical field to a quantum operator by imposing commutation relations between the field phi(x, t) and its conjugate momentum pi(x, t) = partial L / partial (dphi/dt) = dphi/dt. The equal-time commutation relation [phi(x, t), pi(y, t)] = i delta^3(x - y) is the field-theoretic generalization of [q, p] = i hbar.
The key step is decomposing the field into Fourier modes. Each mode with momentum p behaves as an independent harmonic oscillator with frequency omega_p = sqrt(|p|^2 + m^2). Quantizing each mode introduces creation operators a_p-dagger and annihilation operators a_p satisfying [a_p, a_q-dagger] = (2pi)^3 delta^3(p - q). The field operator becomes phi(x) = integral [a_p e^{ipx} + a_p-dagger e^{-ipx}] d^3p / ((2pi)^3 2E_p). This is not an assumption but a consequence of the commutation relations and the equation of motion.
The Hilbert space of the quantized theory is Fock space: the vacuum |0> has no particles, a_p-dagger|0> is a one-particle state with momentum p, and multi-particle states are built by applying multiple creation operators. The Hamiltonian is H = integral E_p a_p-dagger a_p d^3p / (2pi)^3 (after normal ordering to remove the infinite vacuum energy). Each quantum of excitation carries energy E_p = sqrt(|p|^2 + m^2) and momentum p, which is exactly the relativistic energy-momentum relation for a particle of mass m. The particle interpretation emerges from the mathematics: you start with a continuous classical field, quantize it, and discover that the excitations behave as particles.
This procedure establishes the template for all of quantum field theory. Every free field -- scalar, spinor, vector -- is quantized by the same logic: decompose into modes, identify each mode as a harmonic oscillator, and introduce creation and annihilation operators. The differences between bosons and fermions appear in the commutation versus anticommutation relations. Interactions are added by including additional terms in the Lagrangian density, and their effects are computed perturbatively using Feynman diagrams. But the foundation is always the canonical quantization of the free field.