Evolution of a position state in an infinite well potential 
Let the potential be
$$V = \infty \hspace{3cm}(0>x, x>L)$$ $$V = 0 \hspace{3.7cm}(L>x>0).$$
Now, we measure the position of a particle and discover it is located at $L/4$. What is the probability of finding the particle in each eigenstates of the energy?

So, i guess the wavefunction is $$\psi = \delta(x-L/4)$$
We know the eigenbasis is given by
$$\sqrt{\frac{2}{L}} \sin(n \pi x/L).$$
Then
$$\delta(x-L/4) = \sum_n c_n \sqrt{\frac{2}{L}} \sin(n \pi x/L) \\ c_n = \sqrt{\frac{2}{L}} \int \delta(x-L/4) \sin(n \pi x /L)dx = \sqrt{\frac{2}{L}} \sin(\frac{\pi n}{4})$$
But, $\sum |c_n|^2 $ diverges!
So how do i define the probability (generally given by $P_n = \frac{|c_n|^2}{\sum |c_n|^2}$?
 A: Lots of things are wrong with $\psi=\delta(x-L/4)$.
First, you cannot normalize it since
$$
\int_0^L \vert \psi\vert^2 dx = \int_0^L dx \delta(x-L/4)^2 = \delta(0)
$$
is technically infinite.
Next, on dimensional grounds $\psi=\delta(x-L/4)$ does not work.  Since
$$
\int dx \vert \psi\vert^2 
$$
is a probability and thus a dimensionless number, $\psi$ should have dimension of 1/(length)$^{1/2}$, so you $\psi$ does not have the correct dimension.
Another way to see the same thing is that your expansion coefficients $c_n$ do actually have the dimension of (length)$^{-1/2}$ so their modulus square cannot be interpreted as a (dimensionless) probability of finding your initial state in an energy eigenstate.
Sooooo… Your wavefunction $\psi$ is incorrect.
You may want to try instead a normalized Gaussian initial state that is very strongly peaked $x=L/4$, and then take the limit where the width of the Gaussian goes to $0$.  Note that such a Gaussian would only approximately satisfy the boundary condition of the problem since the tail of the Gaussian would extend beyond the well, but you might be able to recover something meaningful in the limit of zero width.

Edit: Following the comments of @MichaelSeifert and others, I did some additional work, using
$$
\psi(x)=\left\{\begin{array}{ll}1/\sqrt{\epsilon}& \text{if } 1/4-\epsilon/2 < x< 1/4+\epsilon/2\, ,\\
0&\text{otherwise}
\end{array}\right.
$$
with $L=1$ for simplicity, and hoping to recover something in the limit where $\epsilon\to 0$ and sharply peaked $\psi$.
It is possible to obtain the expansion coefficients
$$
c_n(\epsilon)=\frac{2 \sqrt{2} \sin \left(\frac{\pi  n}{4}\right) \sin \left(\frac{\pi  n \epsilon }{2}\right)}{\pi  n \sqrt{\epsilon }}\, .
$$
Expanding the $\sin(n\pi \epsilon/2)$ term yields
$$
\vert c_n(\epsilon)\vert^2 = \frac{1}{180} \epsilon  \left(
360-30 \pi ^2 n^2 \epsilon ^2+\pi ^4 n^4 \epsilon ^4+\ldots \right) \sin ^2\left(\frac{\pi  n}{4}\right)\, .
$$
You can easily see how we get in trouble: for any given $\epsilon>0$, there is $n_0$ so that, for any $n>n_0$, $n^2\epsilon^2\pi^2>1$  and the series for $\vert c_n(\epsilon)\vert^2$ stops to make sense as an expansion.
The interesting part is that for finite $\epsilon$, the values of
$\vert c_n(\epsilon)\vert^2$ for large $n$, which apparently cause trouble in the expansion of $\vert c_n(\epsilon)\vert^2$, become numerically very small.  This is clear from the expression for $c_n(\epsilon)$: for finite $\epsilon$ $c_n(\epsilon)$ scales like $1/n$, and since $\vert\sin(n \pi\epsilon/2)\vert$ is bounded by one, eventually this must decrease.
For instance, for $\epsilon=1/25$ we have the following plots for the values of $\vert c_n(\epsilon)\vert^2$:

Summing the probabilities from $n=1$ to $n=500$ gives $0.989873$, so the first $500$ terms capture 99% of the initial state.
For $\epsilon=1/50$, the plot is qualitatively the same, except that the vertical scale is divided by $2$, reflecting the scaling with $\epsilon$ of the leading term
$2\epsilon\sin\left(n\pi /4\right)^2$.  One needs to now sum to $n=1000$ to get $\sim 99$% of the initial state.
