  The rare kaon decays $K\to\pi\nu\bar{\nu}$ are strongly suppressed in the
standard model and widely regarded as processes in which new phenomena, not
predicted by the standard model, may be observed. Recognizing such new
phenomena requires precise standard model prediction for the braching ratio of
$K\to\pi\nu\bar{\nu}$ with controlled uncertainty for both short-distance and
long-distance contributions. In this work we demonstrate the feasibility of
lattice QCD calculation of the long-distance contribution to rare kaon decays
with the emphasis on $K^+\to\pi^+\nu\bar{\nu}$. Our methodology covers the
calculation of both $W$-$W$ and $Z$-exchange diagrams. We discuss the
estimation of the power-law, finite-volume corrections and two methods to
consistently combine the long distance contribution determined by the lattice
methods outlined here with the short distance parts that can be reliably
determined using perturbation theory. It is a subsequent work of our first
methodology paper on $K\to\pi\ell^+\ell^-$, where the focus was made on the
$\gamma$-exchange diagrams.
