  We study the dynamic structure factor of a one-dimensional Bose gas confined
in an optical lattice and modeled by the Bose-Hubbard Hamiltonian, using a
variety of numerical and analytical approaches. The dynamic structure factor,
experimentally measurable by Bragg spectroscopy, is studied in three relevant
cases: in the clean regime, featuring either a superfluid or a Mott phase; and
in the presence of two types of (quasi-)disordered external potentials: a
quasi-periodic potential obtained from a bichromatic superlattice and a
random-box disorder - both featuring a Bose glass phase. In the clean case, we
show the emergence of a gapped doublon mode (corresponding to a repulsively
bound state) for incommensurate filling, well separated from the low-energy
acoustic mode. In the disordered case, we show that the dynamic structure
factor provides a direct insight into the spatial structure of the excitations,
unveiling their localized nature, which represents a fundamental signature of
the Bose glass phase. Furthermore, it provides a clear fingerprint of the very
nature of the localization mechanism which differs for the two kinds of
disorder potentials we consider. In special cases, the dynamic structure factor
may provide an estimate of the position of the localization transition from
superfluid to Bose glass, in a complementary manner to the information deduced
from the momentum distribution.
