It's a technological tour-de-force involving deformable mirrors that change shape every millisecond, cameras able to count every incoming photon, and special computers designed to calculate the next correction within microseconds. As usual wikipedia has an introduction: https://en.wikipedia.org/wiki/Adaptive_optics