A search for heavy resonances decaying into a pair of Z bosons leading to ℓ+ℓ-ℓ+ℓ- and ℓ+ℓ- final states, where ℓ stands for either an electron or a muon, is presented. The search uses proton–proton collision data at a centre-of-mass energy of 13 TeV corresponding to an integrated luminosity of 36.1 fb - 1 collected with the ATLAS detector during 2015 and 2016 at the Large Hadron Collider. Different mass ranges for the hypothetical resonances are considered, depending on the final state and model. The different ranges span between 200 and 2000 GeV. The results are interpreted as upper limits on the production cross section of a spin-0 or spin-2 resonance. The upper limits for the spin-0 resonance are translated to exclusion contours in the context of Type-I and Type-II two-Higgs-doublet models, while those for the spin-2 resonance are used to constrain the Randall–Sundrum model with an extra dimension giving rise to spin-2 graviton excitations.