The general solution of the Laplace equation in spherical coordinates is (independant of $\phi$):
$$V(r,\theta ) = \sum ^{\infty} _{l=0} \left( A_l r^l + \frac{B_l}{r^{l+1}} \right) P_l (\cos \theta ))$$
An example (Griffiths EM, 3rd edition, example 3.6):
The potential $V_0 (\theta )$ is specified on the surface of a hollow sphere of radius $R$. Find the potential inside the sphere.
Here $B_l$ must be zero because it would blow up at the origin, this is clear, but the next step loses me.
The Legendre polynomials constitute a complete set of functions on the interval $-1 \le x \le 1$ $(0\le \theta \le \pi)$
$$\int ^1 _{-1} P_l (x) P_{l'} (x) dx = \int ^\pi _0 P_l (\cos \theta ) P_{l'} (\cos \theta ) \sin \theta d\theta.$$
Because they are orthogonal functions if $l\ne l'$ the integral is zero, how ever if they are equal, we get an answer of $\frac{2}{2L+1}$, where did this answer come from? Griffiths skips this step.
Why was $\sin$ introduced into the second integral?
I think the Legendre polynomial is tripping me up. How are these dealt with under integrals?
To prove that Legendre polynomials are orthogonal, i.e. $$ \int_{-1}^1 P_n(x)P_m(x)\,\text{d}x = \frac{2\,\delta_{m,n}}{2n+1} $$ you can use Rodrigues' formula (eq 3.62 in Griffiths): $$ P_n(x) = \frac{1}{2^n n!}\left(\frac{\text{d}}{\text{d}x}\right)^n (x^2-1)^n. $$ We get $$ I_{mn} = \int_{-1}^1 P_n(x)P_m(x)\,\text{d}x = \int_{-1}^1 \frac{1}{2^{m+n} m!\,n!}\left(\frac{\text{d}}{\text{d}x}\right)^m \!X^m\,\left(\frac{\text{d}}{\text{d}x}\right)^n \!X^n\,\text{d}x, $$ where I used the short-hand notation $X = x^2-1$. Without loss of generality, we can assume that $n\geqslant m$. Let us integrate this by parts: $$ \begin{multline} I_{mn} = \left[\frac{1}{2^{m+n} m!\,n!}\left(\frac{\text{d}}{\text{d}x}\right)^m \!X^m \,\left(\frac{\text{d}}{\text{d}x}\right)^{n-1} \!X^n\right]_{-1}^1 \\- \int_{-1}^1 \frac{1}{2^{m+n} m!\,n!}\left(\frac{\text{d}}{\text{d}x}\right)^{m+1} \!X^m\,\left(\frac{\text{d}}{\text{d}x}\right)^{n-1} \!X^n\,\text{d}x. \end{multline} $$ However, since the derivative $$ \left(\frac{\text{d}}{\text{d}x}\right)^{n-1} (x^2-1)^n $$ will contain a factor $(x^2-1)$, the integrated part will vanish, so that only the integral remains: $$ I_{mn} = -\int_{-1}^1 \frac{1}{2^{m+n} m!\,n!}\left(\frac{\text{d}}{\text{d}x}\right)^{m+1} \!X^m\,\left(\frac{\text{d}}{\text{d}x}\right)^{n-1} \!X^n\,\text{d}x. $$ In this manner, we can integrate by parts $n$ times, until we obtain $$ I_{mn} = (-1)^n\int_{-1}^1 \frac{(x^2-1)^n}{2^{m+n} m!\,n!}\left(\frac{\text{d}}{\text{d}x}\right)^{m+n} \!(x^2-1)^m\,\text{d}x. $$ Now, $$ (x^2-1)^m = x^{2m} - mx^{2m-2} + \ldots $$ So that, if $n>m$, $$ \left(\frac{\text{d}}{\text{d}x}\right)^{m+n} \!(x^2-1)^m = 0, $$ and $I_{mn}=0$.
On the other hand, if $n=m$, we get $$ \left(\frac{\text{d}}{\text{d}x}\right)^{n+n} \!(x^2-1)^n = (2n)! $$ and $$ I_{nn} = (-1)^n\int_{-1}^1 \frac{(2n)!}{2^{2n} n!\,n!}(x^2-1)^n\,\text{d}x. $$ Substituting $x$ with $y = (x+1)/2$, we can rewrite this as $$ I_{nn} = 2\int_0^1 \frac{(2n)!}{n!\,n!}y^n(1-y)^n\,\text{d}y, $$ which is a beta function: $$ I_{nn} = 2\frac{(2n)!}{n!\,n!}B(n+1,n+1) = 2\frac{(2n)!}{n!\,n!}\frac{\Gamma(n+1)\Gamma(n+1)}{\Gamma(2n+2)} = 2\frac{(2n)!}{(2n+1)!} = \frac{2}{2n+1}, $$ and this concludes the proof.
With $x=\cos\theta$, you can write it as $$ \begin{multline} \int_{-1}^1 P_n(x)P_m(x)\,\text{d}x = \int_{-1}^1 P_n(\cos\theta)P_m(\cos\theta)\,\text{d}\cos\theta \\= \int_{0}^\pi P_n(\cos\theta)P_m(\cos\theta)\sin\theta\,\text{d}\theta. \end{multline} $$ Because of the orthogonality property, you can find the coefficients by integrating $V(r,\theta)$ with each Legendre polynomial: $$ \int_{0}^\pi V(r,\theta)P_l(\cos\theta)\sin\theta\,\text{d}\theta = \frac{2}{2l+1}\left(A_lr^l + \frac{B_l}{r^{l+1}}\right). $$