Hello Astrum,
The \left\{ q_{i} \right\} are generalized coordinates defined for a system of N particles by the following set of equations
x_{1} = f_{1}(q_{1},...,q_{m},t)
x_{2} = f_{2}(q_{1},...,q_{m},t)
.
.
.
x_{3N} = f_{n}(q_{1},...,q_{m},t)
Where the \left\{ x_{i} \right\} are the components of the the position vectors of the particles that constitute your system. For example, you could choose \vec{r}_{1} = (x_{1},x_{2},x_{3}) and then continue selecting the components in the same fashion until you get to the position vector of the Nth particle, which would be \vec{r}_{N} = (x_{3N-2},x_{3N-1},x_{3N}). But remember that this is just a convention I've adopted to make things more clear to you at the moment. You could choose your own way of writing the vector's components, as long as they describe correctly the state of your system.
Therefore, for any \vec{r}_{j} if you use the well known result of the Chain Rule and write the "virtual differential" for that vector as
δ\vec{r}_{j} = \sum^{m}_{k=1}\frac{\partial \vec{r}_{j}}{\partial q_{k}}δq_{k}
Here I use the term "virtual differential" because, as you may have noticed, the partial derivative with respect to time is not present in the summation. That is because virtual displacements do not occur because of change in time; they are, in fact, imaginary displacements that you force the particles to undergo (but still respecting the constraints). That being said, you can substitute that result on the equation
δW = \sum^{N}_{i=1}\vec{F}_{i}\centerdot δ\vec{r}_{i}
and get the result
δW = \sum^{N}_{i=1}\vec{F}_{i} \centerdot ( \sum^{m}_{k=1}\frac{\partial \vec{r}_{i}}{\partial q_{k}}δq_{k} ) = (\sum^{N}_{i=1}\vec{F}_{i} \centerdot \frac{\partial \vec{r}_{i}}{\partial q_{1}})δq_{1} + \cdots + (\sum^{N}_{i=1}\vec{F}_{i} \centerdot \frac{\partial \vec{r}_{i}}{\partial q_{m}})δq_{m}
So, this is just a mathematical consequence of our definitions.As to the equation
\sum_{i} (\vec{F}_{i} - m_{i} \vec{a}_i ) \centerdot δ \vec{r}_{i} = 0
As I hope to show, that is just Newton's Second Law written in a different way. We can start by writing
\vec{F}_{i} = m_{i} \vec{a}_i or equivalently \vec{F}_{i} - m_{i} \vec{a}_i = \vec{0}
for a given particle i of your system, where \vec{F}_{i} is the total force applied to the ith particle. Now, we could multiply each of these equations by their respective virtual displacement, i.e., the virtual displacement associated with the ith particle. Therefore, we would obtain
( \vec{F}_{i} - m_{i} \vec{a}_i ) \centerdot δ \vec{r}_{i} = 0
Naturally we can also sum these equations for all particles, which would yield
\sum_{i} ( \vec{F}_{i} - m_{i} \vec{a}_i ) \centerdot δ \vec{r}_{i} = 0
Okay, I believe that now comes the trick that allows you to start the Lagrangian formulation of Classical Mechanics. The idea is that you can decompose the force acting on any particle into forces of Constraint and Applied forces (forces that are not caused by constraints). Let us write this decomposition as
\vec{F}_{i} = \vec{F}_{C; i} + \vec{F}_{A; i}
Substituting this result into our previous equation, we can rearrange the terms and write
\sum_{i} ( \vec{F}_{i} - m_{i} \vec{a}_i ) \centerdot δ \vec{r}_{i} = \sum_{i} ( \vec{F}_{C; i} ) \centerdot δ \vec{r}_{i} + \sum_{i} ( \vec{F}_{A; i} - m_{i} \vec{a}_i ) \centerdot δ \vec{r}_{i} = 0
But, the virtual displacements, by definition, are always orthogonal to the forces of constraint. Therefore, the summation on \vec{F}_{C; i} vanishes, and we finally get
\sum_{i} ( \vec{F}_{A; i} - m_{i} \vec{a}_i ) \centerdot δ \vec{r}_{i} = 0
Which is also the virtual work of the system.
I'm not sure if this will answer your question, but I hope it was helpful. ;)Zag