Infra-red radiation is what causes the heat you feel when you iron clothes or when you lean over a warm automobile engine. If you touch the iron or engine, the burn you get is not caused by the radiation, it is caused as heat is conducted directly to your skin, but that is a different story. The energy absorbed is trapped temporarily near the earth's surface by causing these molecules to vibrate more vigorously. As they vibrate, they radiate heat energy, but it is absorbed by other molecules nearby. Note what happens.
Energy strikes the molecule, causing it to vibrate more vigorously.
As the molecule vibrates, energy is emitted, and the molecule returns to its original state. So instead of leaving the Earth at the speed of light, as it should, it lingers in the atmosphere for a while, and this heat energy causes the average temperature of the atmosphere to be warmer than it would be if the gas molecules did not absorb the energy. Of course, the heat gets out eventually. If it did not, it would build up steadily and the ground surface would be too hot for life to exist. The heat gets out because the air that is absorbing the heat energy circulates as it warms.