Why does it need to firstly factorize the number n into two factors q and r( Lemma 4 in the paper,see the following)? What's the motivation. What if it doesn't do this factorization?

1$\begingroup$ Have you taken a look at how the lemma is applied in the rest of the paper? $\endgroup$ – Tobias Kildetoft Oct 28 '15 at 11:41

$\begingroup$ I have gone through the proof. What I feel it is because it needs to use the double Kloosterman sum estimation. However, I am not quite sure if without the factorization is it possible to use this estimation in the same way (it seems that it can still do in the same way without factorization, that means we let r = 1), or what the required estimation will look like if we don't do this factorization $\endgroup$ – user82037 Oct 28 '15 at 11:47
As Zhang himself says below his (2.8), the factorization $d=qr$, with $r$ in a suitably prescribed range, "is crucial for bounding the error terms". The reason for this is nicely explained in Section 5.2 of the Polymath8a paper (in the published version this is Section 5B).
Very briefly, Zhang's proof relies on the equidistribution of various convolution arithmetic functions in residue classes modulo $d$, where $d$ can be rather large. More precisely, equidistribution is only needed on average over $d$, so we are looking at various sums over the $d$ variable. If a factorization $d=qr$ is available for all the moduli, then the sums can be readily estimated via the triangle inequality and CauchySchwarz.
In short, factoring the moduli efficiently allows one to break up the relevant sums into more manageable pieces: to a great extent this is what analytic number theory is about!