In basic terms, for a molecule to absorb radiation there has to be an oscillating dipole being produced. This can occur by nuclear motion (vibrations, rotations) or electronic motion to produce electronically excited states. You ask about IR radiation, which does not have sufficient energy to produce electronic excitation, so this is ignored in the text below.
The restriction on producing a moving dipole exists because radiation consists of oscillating electric and magnetic fields and to allow energy to go from the radiation into the molecule, there has to be an interaction between radiation and the molecule and the origin of this is the oscillating molecule's dipole. (Of course the radiation also has to have the correct energy to bridge the gap between any two energy levels, but this is just another way of saying that the molecular dipole and the radiation oscillate at the same frequency, i.e. are in resonance.)
Thus in any homonuclear diatomic there is no IR absorption because these molecules have no intrinsic dipole or one caused by vibrations. Also as they have no permanent dipole there is obviously no dipole generated when molecules rotate. Heteronuclear diatomics, HCl for example, all have a permanent dipole and one that is changed by vibrational motion, thus there is a vibrational and rotational spectrum in all heteronuclear diatomics.
All homo-nuclear diatomics, $\ce{N2}$, $\ce{O2}$ for example, are transparent to IR radiation and this is of prime importance in global warming, since if these molecules obtain energy, say by collision with water or carbon dioxide that has been excited by IR radiation, they cannot radiate the energy away and so must heat the atmosphere by collisions with other molecules.
In a molecule such as $\ce{CO2}$ although it has no overall dipole it does have moving (oscillating) dipoles due to the way it vibrates. One mode is to stretch one bond at the same time as the other contacts (an asymmetric stretch), and so an oscillating dipole is formed and this interacts with radiation and $\ce{CO2}$ has an IR vibrational-rotational spectrum. The bending vibration is also IR active.
A similar effect occurs in methane, the way the molecule vibrates develops oscillating dipoles and these interact with the radiation and so absorb energy. Molecular group theory is usually used to sort out which of the $3N-6$ ways molecules can vibrate can have IR spectra.
There are complicated higher order effect even in homonuclear diatomics which may generate absorption but these effect are absolutely tiny and can be ignored for most every purpose. The relative magnitudes of electric dipole, quadrupole and magnetic dipole intensities are $I_\mathrm{dip}:I_\mathrm{quad}:I_\mathrm{mag} \approx 1:10^{-5}:10^{-5}.$
We can measure the vibrational frequency of homonuclear as well as heteronuclear diatomics by using Raman spectroscopy, which is a scattering effect (no photons are absorbed), and depends on the shape of the 'electron cloud' in the molecule. This is more properly called its polarisability.