In electrostatics, we want to solve Poisson's equation for the electric potential $\Phi$.
$$\nabla^2 \Phi = 4 \pi \rho$$
Take, for example, free space, so $\rho = 0$. The resulting equation is Laplace's equation
$$\nabla^2 \Phi = 0$$
There are many solutions, for example $\Phi = 0$ or $\Phi = \Phi_0 e^{k(ix+y)}$ or others. Further, if $\Phi_1$ and $\Phi_2$ are both solutions, then $\alpha \Phi_1 + \beta \Phi_2$ is also a solution.
Poisson's equation has the same difficulty. If you have any solution to Poisson's equation, you can add any solution to Laplace's equation and get a new solution.
If someone said, "I just threw a ball; predict its location as a function of time," we would be in a similar predicament. We could determine a differential equation that describes the ball's motion, but there are many solutions, and we couldn't find the trajectory without knowing where the ball was thrown from and what its initial velocity was. These are boundary conditions. They take a differential equation with many solutions and narrow them down to one physically correct solution.
In the case of Poisson's equation, one sufficient set of boundary conditions is the potential everywhere on the boundary of the area we're studying. The "boundary" can be an infinity, if we want.
For example, if there is a grounded conductor, we set $\Phi = 0$ everywhere on that conductor, then set $\Phi = 0$ at infinity. If we can find any solution to Poisson's equation that also satisfies these two boundary conditions, it will be the only solution, and we will know the potential everywhere outside the conductor.
To prove this uniqueness theorem, imagine there are two solutions, $\Phi_1$ and $\Phi_2$, to Poisson's equation. Then $\Phi_3 = \Phi_1 - \Phi_2$ is a solution to Laplace's equation, and it has $\Phi_3 = 0$ on all the boundaries. Any solution to Laplace's equation has no local minima or maxima, so the extrema must occur at the boudaries. Since all boundaries are zero, $\Phi_3 = 0$ and $\Phi_1 = \Phi_2$.
Now consider the simplest application of the method of images. There is an infinite grounded conducting sheet and a point charge $q$ sitting above it at distance $d$. We need to find any solution to Poisson's equation such that $\Phi = 0$ at infinity and along the sheet.
Discard the sheet momentarily, and consider another point charge $-q$ a distance $2d$ from the first one, so that it looks like its mirror image, with the plane where the conductor was serving as mirror (the original point charge is above the plane; the new one is below the plane an equal distance).
Imagine a test charge sitting on the plane between the two mirror charges. Because the mirror charges have opposite sign, the net force on the test charge has no component in the plane. That means the plane is an equipotential surface, and the point charge can move out to infinity for free, where the potential is clearly zero. Hence, the potential is zero at infinity and all along the plane. The $\Phi$ you get in this scenario is easy to calculate because it's just the potential from two point charges, however, because it meets the boundary conditions, it is also the potential that arises from a point charge sitting above a conductor.
This method of images is not very general. It will work whenever you can think of a clever way to set up an image charge so that the potential with the original charge and the image charge satisfies the same boundary conditions as your original problem. You won't always be able to find a way to do that. In a general case, you'll need to use Green's functions or numerical solution methods.
Reference: This is mostly from Chapter 3 of David Griffiths'
Introduction to Electrodynamics