Electroweak-boson hadroproduction at large transverse momentum: factorization, resummation, and NNLO corrections