Spin fluctuations in iron pnictides and chalcogenides: From antiferromagnetism to superconductivity