OK, so you know what entropy is, right?
It is basically the number W of microscopic states that a system can be in, although for various reasons, we usually prefer working with a multiple its natural logarithm S = k ln(W), where k is the Boltzmann constant and S is called the entropy.
So suppose we have a very simply crystal, with N lattice positions, each of which either contains an atom, or not. If all the lattice positions are filled, there is only one state the system can be in, so W = 1.
If there is one defect, it can be in N different positions, so (assuming no symmetries), W = N.
If there are two defects, the number of possible grids with (N - 2) positions filled and 2 vacant is W = N(N - 1)/2. More generally, if you have n missing atoms in the grid of N, the number of ways that you can choose the n positions to put your defects is (N choose n), i.e. W = N! / ((N - n)! n!).
Of course, there is a maximum here, where exactly half of the sites is filled and the other half is empty. So by entropy considerations alone, it would be most convenient to have half of the crystal empty :)
But then, entropy is not all of the story. Nature makes a big point not about maximizing the entropy, but rather about minimizing the free energy. The formula for this is F = U - TS, where U is the internal energy of the system, T is temperature and S is the entropy. From here you can see that increasing the entropy lowers the free energy, which is precisely what we want, right? But wait, adding defects also has a price: it increases the total internal energy of the system (basically, the reason being that you need to do work to take out an atom from a perfect crystal). So apart from increasing S, you also increase U. Since the target is not to make S as large, but F as small as possible, you need to find a balance between increasing F by adding internal energy, and decreasing it by adding entropy. Each empty spot that you create gives the system more microscopic states to be in, but it also adds energy to it.
If you want to see the formulas, you should go get a good book. If you search on Google Books for example, you can find something like
this, which hopefully helps.