An NIR instrument consists of a beam of light that gets dispersed and split into all the wavelengths that form it (this can happen by different methods. for example grating system or an interferometer). In a grating system the light is split in such a way that only one wavelength of the full spectrum will hit the sample.
Depending on the characteristics of the sample it will absorb and reflect the light in different ways and this information will be collected by a detector. The information for each of the wavelengths gets measured individually.
A computer then processes the information and plots the absorbances measured at each wavelength; this is a spectrum.
Most NIR instruments measure the light reflected from a sample although in certain cases instruments read in transmission (light passing through a sample), but more on that next time.