This is a follow-up question to D'Alembert's Principle and the term containing the reversed effective force.
From the second term of Eq. (1.45) $$\begin{align*} \sum_i{\dot{\mathbf{p}}_i \cdot \delta{\mathbf{r}_i}} &= \sum_i{m_i\ddot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j} \end{align*}$$
Starting from Eq. (1.50), I was able to follow that $$\begin{align*} \sum_i{m_i\ddot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j}} &= \sum_i{\left[ \frac{d}{dt} \left( m_i\mathbf{v}_i \cdot \frac{\partial\mathbf{v}_i}{\partial\dot{q}_j} \right) - m_i\mathbf{v}_i \cdot \frac{\partial\mathbf{v}_i}{\partial q_j} \right]} \end{align*}$$
Goldstein substituted the above equation to (1.45) by saying:
... and the second term on the left-hand side of Eq. (1.45) can be expanded to
By "second term", I understood it to be the very first equation I mentioned above. Therefore this is how I understood it:
$$\begin{align*} \sum_i{\dot{\mathbf{p}}_i \cdot \delta{\mathbf{r}_i}} &= \sum_i{m_i\ddot{\mathbf{r}}_i \cdot \frac{\partial\mathbf{r}_i}{\partial q_j} \delta q_j}\\ &= \sum_i\left[ \frac{d}{dt}\left[ \frac{\partial}{\partial\dot{q}_j} \left( \frac{1}{2}\sum_i{m_iv_i^2} \right) \right] - \frac{\partial}{\partial q_j} \left( \frac{1}{2}\sum_i{m_iv_i^2} \right) - Q_j \right]\delta q_j\\ &= \sum_i{\left[ \frac{d}{dt} \left( \frac{\partial T}{\partial\dot{q}_j} \right) - \frac{\partial T}{\partial q_j} -Q_j \right] \delta q_j} \end{align*}$$
I was able to follow $$\begin{align*} T &= \sum_i{m_i\mathbf{v}_i} \cdot \partial\mathbf{v}_i\\ T &=\frac{1}{2} \sum_i{m_iv_i^2} \end{align*}$$
But I am at a loss: Where does $-Q_j$ come from?
