How exactly are molecules detected in space?
The research article corresponding to the observation to which the question is referring is Detection of the simplest sugar, glycolaldehyde, in a solar-type protostar with ALMA. Note that the molecule is glycolaldehyde rather than glycoaldehyde.

ALMA is the Atacama Large Millimeter/submillimeter Array, a radio telescope array in the Atacama desert.  The extremely low humidity of the Atacama desert minimizes water vapor interference.  

This observation of glycolaldehyde in space is not the first.  It was earlier observed by Greenbank radio telescope, in West Virginia, USA, for example.  The Greenbank observation is reported in INTERSTELLAR GLYCOLALDEHYDE: THE FIRST SUGAR.  Glycolaldehyde was detected through radio signals in the 71-103 GHz range that are photons emitted when the molecule transitions from an excited rotation state to a lower energy rotational state.

In the ALMA observation, the molecule was detected based upon radio signals near 220 GHz and 690 GHz.  These correspond to photons emitted by the molecule when transitioning from an excited rotational state to a lower energy rotational state, but are a different set of transitions from those observed at Greenbank, including some for excited vibrational states.

I'll try to add more information later, there are a wide variety of spectroscopic techniques: absorbance vs. emission; rotation, vibration and electronics transitions, and many different frequency ranges.