Thought process behind certain steps in proofs? soft question here. I recently began my first proof-based course, number theory, and have found myself repeatedly confused and bewildered by a large number of the exercises I've done. While I can follow proofs within my textbook, as well as solutions to proofs relatively well, I'm often baffled by how the proof's author decided to make a specific decision at a specific moment. For example, in the proof below, the author chooses at a crucial moment to add 2b-2b to the equation, which helps complete the proof and is correct, but I can't understand how they thought to make that exact decision or saw it beforehand, as well as . When I tried doing the same exercise on my own, I went through any number of other "tricks" to try and complete the proof, but could never think to use this one. Is this something that comes through seeing and practicing more proofs, or is there a specific thought-process behind this?
Theorem for example proof
Example proof
 A: In my time of active research, trying to prove a theorem worked as follows:
You come up with a theorem that seems to be correct and you try to prove it. At some point you get stuck and you ask yourself why. Then you are able to come up with a counter example to your theorem and have to rewrite the theorem.
You iterate this process until all your counter examples are gone and you have a really deep understanding of why your theorem is correct. 
Now, you could write down all these different things you analysed and really emphasize your thought process to the reader. 
Unfortunately, really strict page limitations force you to bring down all this knowledge to a few sentences, thus only extracting the pure essence of the proof. This leads to "pulling rabbits out of the hat" proofs where somehow everything works out and noone understands why. 
So the only good way to understand a theorem is by doing the same process again, thus many writers include exercises that force you to look at the theorem from different perspectives. If you can complete all these and then again look at the proof it will make MUCH more sense.
A: There is a well-known theorem in number theory that, if $a,b$ are integers with $b>0,$
there are unique integers $q',r'$ such that $a=q'b+r'$ with $0\le r'<b$.  
Here we want to prove that there are integers $q,r$ such that $a=qb+r$ with $2b\le r\lt 3b$.  
The thought to add and subtract $2b$ in the proof of the present theorem is not so mysterious.  
It comes from the fact that 
we have $a=q'b+r'$ with $0\le r'<b$ 
and we want $a=qb+r$ with $2b\le r<3b$, 
so we can take $r=r'+2b$ (and $q'=q-2$) 
in order to get ($a=qb+r$ and) $2b\le r<3b$. 
A: It's easy to show that $a = q'b + r'$ where $0 \le r' < b$
You want $r'$ to become $r$ where $2b \le r<3b$.
It's clear (to me) that $0 \le r' < b$ implies $2b \le 2b + r' < 3b$.
So the obvious substitution would be $r = r' + 2b$.
Instead of the $2b -2b$ thing, you could solve for $r'$, getting $r'=r-2b$ and then substitute.
\begin{align}
   a 
   &= q'b + r' \\
   &= q'b + (r - 2b) \\
   &= (q'b - 2b) + r \\ 
   &= (q'- 2)b + r
\end{align}
So, letting $r=r'-2b$ and $q = q'-2$, you get
$a = qb + r$ where $2b \le r \lt 3b$.
When you get good at this stuff, you can see that adding $0 = 2b - 2b$ into the equation and rearranging terms carefully will accomplish the same thing and then the substitutions needed will be obvious.
