  We study the higher spin algebras of two-dimensional conformal field theory
from the perspective of quantum integrability. Starting from Maulik-Okounkov
instanton R-matrix and applying the procedure of algebraic Bethe ansatz, we
obtain infinite commuting families of Hamiltonians of quantum ILW hierarchy
parametrized by the shape of the auxiliary torus. We calculate explicitly the
first five of these Hamiltonians. Then, we numerically verify that their joint
spectrum can be parametrized by solutions of Litvinov's Bethe ansatz equations
and we conjecture a general formula for the joint spectrum of all ILW
Hamiltonians, based on results of Feigin, Jimbo, Miwa and Mukhin.
  There are two interesting degeneration limits, the infinitely thick and the
infinitely thin auxiliary torus. In one of these limits, the ILW hierarchy
degenerates to Yangian or Benjamin-Ono hierarchy and the Bethe equations can be
easily solved. The other limit is singular but we can nevertheless extract
local Hamiltonians corresponding to quantum KdV or KP hierarchy. Litvinov's
Bethe equations in this local limit provide an alternative to Bethe ansatz
equations of Bazhanov, Lukyanov and Zamolodchikov, but are more transparent,
work at any rank and are manifestly symmetric under triality symmetry of
$\mathcal{W}_{1+\infty}$. Finally, we illustrate analytic properties of the
solutions of Bethe equations in minimal models, in particular for Lee-Yang CFT.
The analytic structure of Bethe roots is very rich as it captures the
representation theory of $\mathcal{W}_N$ minimal models.
