Electric field above a ring of charge To find the electric field at a point $p$ which is at a distance $h$ above the center of a ring of total charge $q$ with radius $r$, one can integrate the charge density over the circumference of the ring and get:
$$E = \frac{qh}{4\pi\epsilon_o(r^2+h^2)^{\frac{3}{2}}}$$
Another approach is to sum up the total charge on the circumference and multiply it by the distance between each point on the circumference and point $p$. The distance from $p$ to any point on the circumference is constant and is equal to:
$$\sqrt{r^2+h^2}$$
Since the horizontal components of the field cancel out, the field can be calculated as:
$$E = \frac{q}{4\pi\epsilon_o d^2} = \frac{q}{4\pi\epsilon_o\,(r^2+h^2)}$$
The two approaches yield different results, so the second must be wrong. But where?
 A: 
Firstly the first method you have shown is correct and the second is wrong .
As you can clearly see in the diagram the force due to each elemental charged particle makes an angle $\theta$ with the axis so the net  force is $F\cos\theta$ along the axis due to each particle and the net force due to 2 diametrically opposite particle as shown in the diagram is $2F\cos\theta$ along the axis. The value of $\cos \theta$ is obtained as $\frac{d}{\sqrt{R^2+d^2}}$. In your second  derivation you have missed out the $\cos\theta$ term. Then$$F=\frac{Kdq}{R^2+d^2}$$
$$F \cos\theta = \frac{Kdq\cdot d}{(R^2+d^2)(\sqrt{(R^2+d^2)}}$$
$$ E = \frac{KQ\cdot d}{4\pi \epsilon_0(R^2+d^2)^\frac{3}{2}}$$
A: What you miss in the second method is that the vertical component of the field is not equal to the total magnitude of the field. As you said, the horizontal components cancel out so you have to sum the vertical components only. You can tell that the second formula is wrong with no calculation. The field in the center of the ring should be zero (the field of each piece is all horizontal) and the formula does not produce this result.
