Derivation (separation of variables on a rectangle)
We try a solution of the form $$ \begin{align*} \phi(x,y) = X(x) Y(y). \end{align*} $$ Then $\Delta \phi = 0$ becomes $$ \begin{align*} X''(x) Y(y) + X(x) Y''(y) = 0 \implies \frac{X''(x)}{X(x)} + \frac{Y''(y)}{Y(y)} = 0. \end{align*} $$ Since $x$ and $y$ are independent, both terms must be constant, i.e. $$ \begin{align*} \frac{X''}{X} = -\lambda, \qquad \frac{Y''}{Y} = \lambda \\ \end{align*} $$ for some constant $\lambda$.
Therefore we require $$ \begin{align*} &\begin{cases} X'' + \lambda X = 0, & 0<x<1, \\ X(0) = 0, \\ X(1) = 0, \\ \end{cases} \\ &\begin{cases} Y'' - \lambda X = 0, & 0<y<1, \\ Y(0) = 0. \end{cases} \end{align*} $$
The general solution to $X$ is $$ \begin{align*} X(x) = A \sin (\sqrt{\lambda}\ x) + B\sin(\sqrt{\lambda}\ x) \end{align*} $$ and applying the conditions gives $$ \begin{align*} \lambda = \lambda_n = (n\pi)^2, \qquad X_n(x) = \sin(n\pi x), \qquad n=1,2,3,\ldots. \end{align*} $$ The solutions are orthogonal: $$ \begin{align*} \langle X_n, X_m\rangle = \int_{0}^{1} \sin(n\pi x)\sin(m\pi x) \d x = \frac{1}{2}\delta_{nm}. \end{align*} $$
Solving the system for $Y$ gives $$ \begin{align*} Y_n(y) = A_n \sinh(n\pi y). \end{align*} $$ Therefore $$ \begin{align*} \phi_n(x,y) = A_n \sin(n\pi x) \sinh(n\pi y) \end{align*} $$ satisfies $\nabla\phi_n = 0$ and $\phi_n = 0$ on $x=0$, $x=1$ and $y=0$.
We can superpose solutions together to get $$ \begin{align*} \phi(x,y) = \sum_{n=1}^{\infty} A_n \underbrace{\sin(n\pi x)}_{X_n(x)} \sinh(n\pi y) \end{align*} $$ and to satisfy the boundary condition on $y=1$, $$ \begin{align*} f(x) = \phi(x,1) = \sum_{n=1}^{\infty} A_n \sinh(n\pi) X_n(x). \end{align*} $$
By orthogonality, $$ \begin{align*} \langle f,X_m\rangle = \sum_{n=1}^{\infty} A_n\sinh(n\pi)\langle X_n, X_m\rangle = \frac{1}{2}A_m \sinh(m\pi). \end{align*} $$ so we have the solution $$ \begin{align*} \phi(x,y) &= \sum_{n=1}^{\infty} A_n\sin(n\pi x)\sinh(n\pi y), \\ A_n &= \frac{2}{\sinh(n\pi)} \int_{0}^{1} f(x)\sin(n\pi x) \d x. \end{align*} $$