How do non-conservative forces affect Lagrange equations? If we have a system and we know all the degrees of freedom, we can find the Lagrangian of the dynamical system. What happens if we apply some non-conservative forces in the system? I mean how to deal with the Lagrangian, if we get any external non-conservative forces perturbs the system? 
Example: 
We have a mass $m$ that is attached with a massless spring. 
We could write the Lagrangian  as $L= \frac{1}{2} m \dot x ^2 + mgx - \frac{1}{2} k x^2$.
What happens to this equation if we consider any non-conservative forces? 
 A: More generally, Lagrange equations$^1$ read 
$$ \frac{d}{dt}\frac{\partial (T-U)}{\partial \dot{q}^j}-\frac{\partial (T-U)}{\partial q^j}~=~Q_j-\frac{\partial{\cal F}}{\partial\dot{q}^j}+\sum_{\ell=1}^m\lambda^{\ell} a_{\ell j}, \qquad j~\in \{1,\ldots, n\}, \tag{L}$$
where


*

*$q^1,\ldots ,q^n,$ are $n$ generalized position coordinates;

*$T$ is the kinetic energy;

*$U$ is a generalized potential;

*${\cal F}$ is the Rayleigh dissipation function for friction forces; 

*$Q_1,\ldots ,Q_n,$ are the remaining parts of the generalized forces, which are not described by the generalized potential $U$ or the Rayleigh dissipation function ${\cal F}$; 

*$\lambda^1,\ldots ,\lambda^m$, are $m$ Lagrange multipliers for $m$ semi-holonomic constraints
$$  \sum_{j=1}^n a_{\ell j}(q,t)\dot{q}^j+a_{\ell t}(q,t)~=~0,  \qquad \ell~\in \{1,\ldots, m\}. \tag{SHC}$$
One may think of the last term on the right-hand side of eq. (L) as the generalized constraint forces for the semi-holonomic constraints (SHC). All other constraints are assumed to be holonomic.
For a discussion of conservative & non-conservative forces, see also e.g. this Phys.SE post.
References:


*

*H. Goldstein, Classical Mechanics; Chapter 1 & 2.


--
$^1$ We distinguish between Lagrange equations (L) and Euler-Lagrange  equations
$$ \frac{d}{dt}\frac{\partial L}{\partial \dot{q}^j}-\frac{\partial L}{\partial q^j}~=~0, \qquad j~\in \{1,\ldots, n\}.\tag{EL} $$ 
In contrast to the Lagrange equations (L), the EL equations are by definition always assumed to be derived from a stationary action principle.
We should stress that it is not possible to apply the stationary action principle to derive the Lagrange equations (L) unless all generalized forces have generalized potentials $U$. See also e.g. this and this Phys.SE posts. 
