In all of the images I've seen from a spectrometer, there's always a collimating element that places an image at infinity so as to have parallel rays hitting a diffraction grating. But why do we need that? I understand that the theory behind gratings is based on a plane wave hitting the grating, but if that were not the case, what implications would it have? I ask this because collimating a beam of light doesn't seem to be an easy task specially if the light source is something like an LED or a simple incandescent bulb, but that's another question, I suppose.
If the beam wasn't collimated then light with different wavelengths but from different parts of the source, arriving at different incidence angles, would be diffracted in the same direction.
This would spoil your wavelength discrimination, contradicting the whole purpose of a diffraction grating.
I completely disagree with the answer by @ProfRob. If a beam is focused beyong the grating, it forms the focused image of a spectrum at the distance of the undiffracted focused beam. As long as the incoming beam has high spatial coherence, the wavelengths are well separated at that spectrum image. Of course aberrations can occur.
The main reason a collimated beam is usually used to illuminate a grating is not that it's necessary; it is simply that it's simpler to visualize what's going on.
When the direction of the incoming beam is changed the interference pattern also changes direction, hence a shift results on the screen. An uncollimated beam is an incoherent superposition of beams from different directions. The results is a convolution of shifted interference patterns, in other words the image will be blurred.