  Nanoelectromechanical systems are characterized by an intimate connection
between electronic and mechanical degrees of freedom. Due to the nanoscopic
scale, current flowing through the system noticeably impacts the vibrational
dynamics of the device, complementing the effect of the vibrational modes on
the electronic dynamics. We employ the scattering matrix approach to quantum
transport to develop a unified theory of nanoelectromechanical systems out of
equilibrium. For a slow mechanical mode, the current can be obtained from the
Landauer-B\"uttiker formula in the strictly adiabatic limit. The leading
correction to the adiabatic limit reduces to Brouwer's formula for the current
of a quantum pump in the absence of the bias voltage. The principal result of
the present paper are scattering matrix expressions for the current-induced
forces acting on the mechanical degrees of freedom. These forces control the
Langevin dynamics of the mechanical modes. Specifically, we derive expressions
for the (typically nonconservative) mean force, for the (possibly negative)
damping force, an effective "Lorentz" force which exists even for time reversal
invariant systems, and the fluctuating Langevin force originating from Nyquist
and shot noise of the current flow. We apply our general formalism to several
simple models which illustrate the peculiar nature of the current-induced
forces. Specifically, we find that in out of equilibrium situations the current
induced forces can destabilize the mechanical vibrations and cause limit-cycle
dynamics.
