Solve by separation of variables $u_{xx}+u_{yy}=0$ where $u(0,y)=u(l,y)=u(x,0)=0$, $u(x,a)=\sin{\frac{n\pi x}{l}}$ Solve by separation of variables \begin{align} u_{xx} + u_{yy} &= 0 \\ u(0,y) &= u(l,y) = 0 \\ u(x,0) &= 0,  u(x,a) = \sin{\frac{n\pi x}{l}} \end{align}
How to solve it?
Putting $u=XY$, I got
$$X_{xx}+\lambda^2 X = 0 = Y_{yy}-\lambda^2 Y$$
They gave solutions $$X=c_1 \cos{\lambda\,x}+c_2\sin{\lambda\,x}, \quad  Y=c_3e^{\lambda\,y}+c_4e^{-\lambda\,y}$$
and hence
$$u = XY = (c_1 \cos{\lambda\,x}+c_2\sin{\lambda\,x})(c_3e^{\lambda\,y}+c_4e^{-\lambda\,y})$$
The boundary conditions $u(0,y)=u(l,y)=0$ implies $c_1=0, \lambda=m\pi/l$. Therefore,
$$u(x,y) = \sin{\frac{m\pi x}{l}} \bigg(A_me^{\frac{m\pi y}{l}}+B_me^{-\frac{m\pi y}{l}} \bigg)$$
What to do next?
 A: You haven't used that $u(x,0)=0$, which gives you $c_3+c_4=0$. So you have
$$
u(x,y)=A_m\,\sin{\frac{m\pi x}{l}}(e^{\frac{m\pi y}{l}}-e^{-\frac{m\pi y}{l}}).
$$
In general what you do next you postulate that the general form of $u$ is
$$\tag1
u(x,y)=\sum_{m=1}^\infty A_m\,\sin{\frac{m\pi x}{l}}(e^{\frac{m\pi y}{l}}-e^{-\frac{m\pi y}{l}}).
$$
In your case, assuming that $n$ is an integer, the condition at $(x,a)$ forces
$$
\sin\frac{n\pi x}l=u(x,a)=A_n\,\sin{\frac{n\pi x}{l}}(e^{\frac{n\pi a}{l}}-e^{-\frac{n\pi a}{l}}).
$$
So
$$
u(x,y)=\frac1{ e^{\frac{n\pi a}{l}}-e^{-\frac{n\pi a}{l}} }\,\sin{\frac{n\pi x}{l}}(e^{\frac{n\pi y}{l}}-e^{-\frac{n\pi y}{l}}).
$$
If you want to use hyperbolic functions,
$$
u(x,y)=\frac{\sinh \frac{n\pi y}l}{\sinh \frac{n\pi a}l}\, \,\sin{\frac{n\pi x}{l}}.
$$

When $n$ is not an integer, you need to consider the full Fourier series. For the orthonormal basis $$\Big\{\frac2l\,\sin\frac{m\pi x}l\Big\}_{m=1}^\infty\cup\Big\{\cos\frac{m\pi x}l\Big\}_{m=0}^\infty,$$
the coefficients for $\sin\frac{n\pi x}l$ are
$$
a_n=\frac4{l^2}\int_0^l\sin\frac{n\pi x}l\,\sin\frac{m\pi x}l\,dx
=-\frac{4(-1)^mm\,\sin\pi n}{\pi l(m^2-n^2)}
$$
and for the cosines they are zero since our function is odd. So
$$\tag2
\sin\frac{n\pi x}l=-\frac2l\sum_{m=1}^\infty \frac{4(-1)^mm\,\sin\pi n}{\pi l(m^2-n^2)}\,\sin\frac{m\pi x}l.
$$
Comparing $(2)$ and $(1)$ (with $y=a$),
$$
2A_m\sinh \frac{n\pi a}l=\frac{8(-1)^{m+1}m\,\sin\pi n}{\pi l^2(m^2-n^2)}.
$$
Thus
$$
u(x,y)=\sum_{m=1}^\infty \frac{4(-1)^{m+1}m\,\sin\pi n}{\pi l^2(m^2-n^2)\,\sinh \frac{n\pi a}l}\,\sin{\frac{m\pi x}{l}}\,\sinh\frac{m\pi y}l.
$$
