Why is the B field of a solenoid equal to $\mu_0 i n$ while that of a loop is $\frac{\mu_0 i R^2}{2(R^2+z^2)^{3/2}}$? In the B field of the loop, if R is the radius and z is the distance along the axis perpendicular to the center of the loop, let z go to zero, and multiply by N loops. Starting with the B field of the loop axis: 
$$B=\frac{\mu_0 i R^2}{2(R^2+z^2)^{3/2}}$$
Becomes:
$B_{\text{N loops}}=\frac{\mu_0 i N}{2R}$ and not $B_{\text {solenoid}}=\mu_0 i n$. What is the difference?

 A: You can think of a solenoid as containing an infinite number of loops stacked one on top of the other.  Thus, the expression for one loop becomes a small contribution to the net field of the solenoid:
$$
B_{loop}\to dB_{solenoid}= \frac{\mu_0 (nidz) R^2}{2(R^2+z^2)^{3/2}}
\tag{1}
$$
where $n$ is the number of turns per meter so that $ndz$ is the number of current loops in a stack of thickness $dz$.  Basically $n$ measures how densely you stack your loops.
Summing over all these loop contributions gives
$$
B_{net}=\int_{-\infty}^\infty dB =\mu_0 ni \tag{2}
$$
as in the solenoid. 
This solution, which uses the superposition principle, is "easy" because the field on the symmetry axis of a loop is easy to compute.  
A more general approach, using Ampere's law, shows that the field is constant inside the soleinoid, even for points that are off-axis.  This latter result can also be shown using superposition but the integrations involved are a lot more technical.
A: Let's discuss the matter both qualitatively and quantitatively
Quantitative Discussion
First of all let's derive the expression for the magnetic field at the axis of a current carrying coil


Let's begin with a coil of a single turn and derive the expression for the magnetic field on the axis of this coil. The cos components of the magnetic field cancel out due to symmetry and the sine components add up along the axis. So we have the field as $$dB=\frac{\mu_0Idl\sin\alpha}{4\pi r^2}\sin\theta$$
Here $\alpha=\frac{\pi}{2}$, so $\sin\alpha=1$ ($\alpha$ is the angle b/w the face of the loop and the object).
or $$dB=\frac{\mu_0Idl}{4\pi r^2}\sin\theta$$ or $$B=\int\frac{\mu_0Idl}{4\pi r^2}\frac{R}{r}$$ or $$B=\frac{\mu_0IR}{4\pi r^3}\int dl$$ 
($\int dl= 2\pi r$ i.e. the circumference of the coil) or $$B=\frac{\mu_0IR}{4\pi r^3} 2\pi R$$ or $$B=\frac{\mu_0IR^2}{2(R^2+x^2)^\frac{3}{2}}$$
Now for an object at the centre of the coil $x=0$ so $$B=\frac{\mu_0I}{2R}$$
Now the point is that we can extend this formula for a coil of N turns iff the thickness of the coil is small(better if negligible) i.e all the loops are nearly on the same cross section. Otherwise if the coil is considerably thick then we cannot apply this derivation. For a thick coil (solenoid) the derivation is different

Let us discuss about this coil of thickness t. Here we cannot apply the above derivation as the coil is thick. If we wish to derive the expression of magnetic field on the axis of this coil with the method we did before we will not only have to integrate along the circumference of each individual loop of the coil but also along the length of the coil. Thus it would be better if in this case we consider our differential element not to be $dl$ on the circumference of the coil, but to be a coil of small thickness $dx$ itself and this brings us to the logic for deriving the magnetic field on the axis of a solenoid.
 
Let 'N' be the number of coils per unit length of the solenoid. So in the length $dx$ there will be $Ndx$ number of coils.
The field experienced by an object O at the centre of this solenoid is given by $$dB=\frac{\mu_0NdxIR^2}{2(R^2+x^2)^\frac{3}{2}}$$ Now we can substitute $x$ as $R\tan\theta$ so $$x=R\tan\theta$$ or $$dx=R\sec^2\theta d\theta$$ putting these values we get $$dB=\frac{\mu_0NI\cos\theta d\theta}{2}$$ integrating the expression from $-\frac{\pi}{2}$ to $+\frac{\pi}{2}$ we get $$B=\int_\frac{-\pi}{2}^\frac{\pi}{2} \frac{\mu_0NI\cos\theta d\theta}{2}$$ or $$B=\frac{\mu_0NI}{2} \int_\frac{-\pi}{2}^\frac{\pi}{2} \cos \theta d\theta$$ or$$B=\frac{\mu_0NI}{2} (\sin\frac{\pi}{2} -\sin(-\frac{\pi}{2}))$$ or $$B= \mu_0NI$$ which is the required expression for the field at the centre of a solenoid.
Look in this derivation, unlike the first one here we have assumed the differential element to be a coil of small thickness $dx$ rather than assuming a small length $dl$ on any of the coils.
so for the thick coil the derivation will be 

Qualitative Discussion
For a coil of n turns we can apply the formula $$B=\frac{\mu_0NI}{2R}$$ only when all the $N$ turns of the coil are nearly on the same cross section. Otherwise we will have to resort to the expression of solenoid. 
I hope these helped clear ur doubts
