A search for a new scalar resonance decaying to a pair of Z bosons is performed in the mass range from 130 GeV to 3TeV, and for various width scenarios. The analysis is based on proton-proton collisions recorded by the CMS experiment at the LHC in 2016, corresponding to an integrated luminosity of 35.9 fb(-1) at a center-of-mass energy of 13TeV. The Z boson pair decays are reconstructed using the 4l, 2l2q, and 2l2 nu final states, where l = e or mu. Both gluon fusion and electroweak production of the scalar resonance are considered, with a free parameter describing their relative cross sections. A dedicated categorization of events, based on the kinematic properties of associated jets, and matrix element techniques are employed for an optimal signal and background separation. A description of the interference between signal and background amplitudes for a resonance of an arbitrary width is included. No significant excess of events with respect to the standard model expectation is observed and limits are set on the product of the cross section for a new scalar boson and the branching fraction for its decay to ZZ for a large range of masses and widths.