About the derivation of the time dilation I'm referring to the common example of deriving time dilation from the light clock.
Let O be standing still with his light clock and O' move at a speed of u.
We consider the O measures his time as $t_0$=2d/c where d is the distance between the two mirrors(from where the light reflects off) 
Next, we see that, O observes the light to have traveled a longer distance in O''s hands, i.e, $\sqrt{(ct_0)^2 + (ut)^2}$ (Before dividing it by c to get the time, changed due to the lorentz factor)
Why do we use ut as the distance travelled by O' and not $ut_0$ ? Because according to O, O' moves at a speed of $u$ and hence, in his view, won't O move across a distance of $ut_0$ metres in his frame? So why do we use $ut$ and not $ut_0$? 
 A: You want to compute what time each observer sees. While O is at rest with the light clock, he simply sees the light go back and forth in $t_O=2d/c$, which is the time for one "tick" of O's clock.
Now let's go in the point of view of O'. He sees the clock moving with a speed of magnitude $u$. I think that's where your confusion lies. It's O' that looks at the clock and sees it moving, and it is that movement that changes the behavior of the clock. In other words, we care about how much distance has the clock traveled, as seens by O'.
Now, we want to compute how much time elapses in $O'$ point of view between two "ticks" of the clock. Let's call this as of yet unknown time $t_{O'}$. We know that, because the clock appears to be traveling with speed $u$ according to $O'$, if we wait $t_{O'}$ the clock will have moved a distance of $ut_{O'}$.
By drawing a picture, and using that $2d=t_O c$, he gets that : $$ct_{O'} = \sqrt{((ct_O)^2+(ut_{O'})^2}\Leftrightarrow t_{O'} = \frac{t_O}{\sqrt{1-\frac{u^2}{c^2}}}$$
Which gives the expected result, since the clock is traveling with a speed $u$ according to $O'$, when one second passes according to $O$, for $O'$, more time will have elapsed. In other words, according to $O'$ that sees $O$ move with speed u, the clock seems to run slower for $O$. 
To make it clearer, if $O'$ is carrying a clock as well, his clock will tick faster than the one held by $O$. Of course we can reverse the reasoning, and from the point of view of $O$, the clock he helds will tick faster than $O'$, since in his point view it is $O'$ that has a speed u.
A: In $O$ frame, time passed between subsequent ticks of light clocks is given by the time light passes the distance $2d$.
In $O'$ frame the time passed between these same ticks, is given by the time light passes the distance $2d'$ in direction perpendicular to velocity of $O$ frame  as measured by $O'$ plus the distance resulting from movement of $O$ in the direction of its velocity. In $O'$ frame, the later is given by the speed of $O$ from the point of view of $O'$ times the time passed from the point of view of $O'$. Basically, you are analyzing what happens from the point of view of $O'$, so don't bring other frames in. Thus you get that light passed the distance $\sqrt{(2d')^2+(ut)^2}$ in $O'$ frame. But since perpendicular distance $d=d'$ is same in both frames, you can substitute from $t_0=2d/c$ to get your formula.
