We present late-time near-infrared (NIR) and optical observations of the type IIn SN 1998S. The NIR photometry spans 333-1242 days after explosion, while the NIR and optical spectra cover 333-1191 days and 305-1093 days respectively. The NIR photometry extends to the M-band (4.7 mu), making SN 1998S only the second ever supernova for which such a long IR wavelength has been detected. The shape and evolution of the H alpha and HeI 1.083 mu line profiles indicate a powerful interaction with a progenitor wind, as well as providing evidence of dust condensation within the ejecta. The latest optical spectrum suggests that the wind had been flowing for at least 430 years. The intensity and rise of the HK continuum towards longer wavelengths together with the relatively bright L and M magnitudes shows that the NIR emission was due to hot dust newly-formed in supernovae may provide the ejecta and/or pre-existing dust in the progenitor circumstellar medium (CSM). [ABRIDGED] Possible origins for the NIR emission are considered. Significant radioactive heating of ejecta dust is ruled out, as is shock/X-ray-precursor heating of CSM dust. More plausible sources are (a) an IR-echo from CSM dust driven by the UV/optical peak luminosity, and (b) emission from newly-condensed dust which formed within a cool, dense shell produced by the ejecta shock/CSM interaction. We argue that the evidence favours the condensing dust hypothesis, although an IR-echo is not ruled out. Within the condensing-dust scenario, the IR luminosity indicates the presence of at least 0.001 solar masses of dust in the ejecta, and probably considerably more. Finally, we show that the late-time intrinsic (K-L) evolution of type II supernovae may provide a useful tool for determining the presence or absence of a massive CSM around their progenitor stars.