Boundary conditions in E&M While deriving boundary condition for $B$ and $D$ we take a pill, box but for $E$ and $H$ we take a rectangular loop, why?
 A: The reason for this is the fact the fields obey equations which we can use by integrating the fields over a well chosen domain to get the useful conditions the fields obey at the dielectric boundary:
The sources and sinks of the D-field are free electric charges, which (in most problems like this) are not present at the dielectric boundary, meaning we have:
$  \nabla \bullet D = 0 $
If we choose to integrate the flux of D out of a pillbox shaped region, we can use this equation with the divergence theorem to show that this integral is zero, meaning the normal component of D is constant across the dielectric boundary. 
The important thing is that we can take advantage of the above equation, by choosing an appropriate integration domain to get a useful fact about the D-field at dielectric boundaries. If we somehow tried to integrate this in a loop, we wouldn't be able to do this.
Likewise, there are no magnetic monopoles and Maxwells equations tell us:
$  \nabla \bullet B = 0 $
, so we can do the exact same procedure as before with the B field.
On the other hand, (for static fields) we have:
$  \nabla \times E = 0 $ 
The only way we can utilise this would be to take the line integral of the E-field in a loop and use Stokes theorem with the above equation to show this is zero and obtain the condition that the parallel component of the E-field is constant across the boundary. Likewise the H field, in absence of free current and in the static case obeys $  \nabla \times H = 0 $, so we should choose the loop integral again.  
A: That's the way to extract boundary conditions about the normal (tangential) field direction from a divergence (curl) in Maxwell equations, cf. Gauss' (Stokes' circulation) theorem, respectively.
A: This is because the integral version of the (time-dependent) Maxwell equations
\begin{align}
\oint \vec D\cdot d \vec S&=q_{encl}\\
\oint \vec B\cdot d\vec S&= 0
\end{align}
involve integrating over surfaces whereas
\begin{align}
\oint \vec E\cdot d\vec\ell &=0\\
\oint \vec H\cdot d\vec \ell&=I_{encl}
\end{align}
involve integrating over contours.  Hence you need to use a small surface for the BC on $\vec D$ and $\vec B$ but a small contour for $\vec E$ and $\vec H$.  Note that $d\vec S$ is normal to the surface, so provides information about the normal components to $\vec D$ or $\vec B$; on the other hand, $d\vec \ell$ is tangential to the circuit, so provides information about the tangential components of $\vec E$ and $\vec H$.
The interesting part is what happens in the time-dependent case, as the last two equations are modified by additional terms.  In this case, for instance,
$$
\oint \vec E\cdot d\vec \ell=-\frac{d}{dt} \int \vec B\cdot d\vec S
$$
involves a surface, but if the countour $C$ bounding the surface $S$ has sides of size $\epsilon$, the circuit will have perimeter of size $\epsilon$ but the surface bounded by this countour will be of size $\epsilon^2$, to that time-dependent Faraday term is ignored in the analysis of the (local) boundary conditions on the fields since this term is of size $\epsilon$ smaller than the term due to the contour.    The same type of argument holds for the displacement current term that gets added to the Amperian term in $\oint \vec H\cdot d\vec\ell$.
