Why is a buffer solution best when pH = pKa i.e. when A-/HA=1
Preliminaries

There are many ways in which you can go about defining a "Buffer Capacity". A good intuitive way to start would be to say, it is tha maximum amount of acid (or base) the solution can tolerate before it starts showing a significant change in pH. While this is not bad, it obviously begs the question what is deemed "significant"? 

However, let us start at the very beginning by examining (in very basic terms) how a buffer works. 

Say, you have some amount of $\ce{A^-}$ in the solution and some amount of $\ce{HA}$. You add a strong acid to the solution, and this leads to an influx of $\ce{H^+}$ ions; the buffer responds by forming more $\ce{HA}$ through the combination of $\ce{A^-}$ and $\ce{H^+}$. Similarly, you add a strong base to the solution, and you have a lot of $\ce{OH^-}$ floating around, and the soultion responds appropriately, by favouring the disassociation of $\ce{HA}$, the $\ce{H^+}$ so released combines with the $\ce{OH^-}$ and neutralises it.

The equilibrium we are interested in is $$\ce{HA &lt;=&gt; A^- + H^+}$$ 

an increase in acidity causes a shift to the left, and an increase in basicity causes a shift to the right. 

So, in this way a buffer acts a proton sink, absorbing/releasing protons as appropriate to maintain the pH of the solution. 

The buffer is said to be broken when we add to much acid/base, and this consumes all of the $\ce{A-}$ / $\ce{HA}$ respectively. 

A solution with more weak base, $\ce{A-}$, has a higher buffer capacity for addition of strong acid. A solution with more weak acid, $\ce{HA}$, has a higher buffer capacity for addition of strong base.So although the pH of a buffer is determined by only the ratio conjugate base and acid, the ability of the buffer to absorb strong acid or base is determined by the individual concentrations of the conjugate base and acid.

So it might seem intuitive to have the optimum at equal concentrations of conjugate base and acid. 



Intuitive definitions

$$\ce{HA + OH^- &lt;=&gt; A^- + H2O }$$
$$\ce{A^- + H3O^+ &lt;=&gt; HA + H2O}$$
$$pH + pOH = 14$$ 

The following discussion is largely inspired by this paper (free to read)

Namely, if you you have $$\mathrm{pH} = \mathrm{pK_a} + \log \left( \frac{A^-}{HA}\right)$$

Since, $\mathrm{pK_a}$ is a fixed number, an changes that can take place to the pH value are caused by the $\log \left( \frac{A^-}{HA}\right)$ term. 

so, we can say $$ \mathrm{pH} = \mathrm{pK_a} + \delta \\ \text{where}\ \delta = \log \left( \frac{A^-}{HA}\right)$$

make $\delta = 0$ and you are done. You can call that your ideal case, an ideal buffer.

Now, you can consider a buffer's resistance to base and acid separately, and you can define an acid and base buffer capacity ($\beta_a$ and $\beta_b$), for very simple cases (read caveats).

The stoichiometric ratio of of conjugate base and acid is 1:1. $\Delta$ denotes an arbitrary change in $\delta$ after $\alpha$ mol of $\ce{HA}$ has reacted (after addition of a strong base)

$$\delta + \Delta = \log \left( \frac{[A^-] + \alpha}{[HA] - \alpha}\right)$$

One then notes that bases attempt to increase the pH of a solution so $\Delta = 1$, and also let us denote $\beta_b$ as the buffer base capacity. Also, note that $\alpha = \beta_b$. We are interested in the maximum amount of base a 1:1 buffer solution can tolerate before the pH increases by one unit. We are assuming a 1:1 stoichiometry between the the weak acid in our buffer and the strong base that is being added to it.

$$10^{\delta + 1 } = \left( \frac{[A^-] + \beta_b}{[HA] - \beta_b}\right) $$

We solve for beta and substitute for $\delta$ to ultimately get, 

$$ \beta_b = \frac{9[\ce{HA}][\ce{A^-}]}{10[\ce{HA}] + [\ce{A^-}]}$$

Now, let us consider that we are adding a strong monoprotic acid. The approach is similar to the one described above. A few key differences is one lets $\Delta = -1$ and let $\alpha = -\beta_a$

I am omitting the algebra involved. You can attempt as an exercise it if you'd like, and ask for clarifications in the comments if you run into trouble. We obtain a similar relation

$$ \beta_a = \frac{9[\ce{HA}][\ce{A^-}]}{10[\ce{HA}] + [\ce{A^-}]}$$

$\beta_a = \beta_b$ if and only if $\delta = 0$ Otherwise, the buffer either displays stronger resistance towards acids or bases.



Caveats 

This is a good exercise to develop a good basic understanding, however doesn't have a lot of practical uses. Here, only a simple buffer was considered, i.e one without multiple weak bases and acids. Additionally, polyprotic acids haven't been accounted for.



Formal defintion of buffer capacity

The formal definition of buffer is a little bit intimidating, but I will throw it in here anyway. It obviously makes little sense to have two different kinds of capacities, one for acids and one for bases in everyday life. So we need something more general, which still incorporates the intuition we have developed so far (although it might not seem obvious)

Let $n$ be number of equivalents of added strong base (per 1 L of the solution). Note that addition of $dn$ moles of acid will change pH by exactly the same value but in opposite direction. I will try to derive a formula connecting buffer capacity with pH, pKa and buffer concentration- all numbers we can obtain easily.

For simplicity, I assume that the strong base is monoprotic, and we have volume of 1 (which will allows me to use concentration and number of moles interchangeably)

$$\beta = \frac{\mathrm{d}n}{\mathrm{d}pH} \tag{1}$$

Charge balance of the solution is given by the equation
$$[\ce{A^-}]+[\ce{OH^-}] = [\ce{B^+}] + [\ce{H^+}] \tag{2}$$

$[\ce{B+}]$ is nothing but concentration of the strong base present, or the number of moles present since we assume a volume of 1 L(:D ), so it is simply $n$ in the solution.

$$C_{b} = [\ce{HA}]+[\ce{A-}] \tag{3}$$

and $$[\ce{HA}] = \frac{[\ce{A-}][\ce{H+}]}{K_a} \tag{4}$$

from 3 and 4, 

$$ [\ce{A-}] = \frac{C_bK_a}{K_a+ [\ce{H+}]} \tag{5} $$

Using the definition of $K_w$, equation 2 and 5

$$n = \frac{K_w}{[\ce{H+}]} - [\ce{H+}]+ \frac{C_bK_a}{K_a+ [\ce{H+}]} \tag{6}$$

$$\beta = \frac{\mathrm{d}n}{\mathrm{d}pH} = \frac{\mathrm{d}n \mathrm{d}[\ce{H+}]}{\mathrm{d}[\ce{H+}]\mathrm{dpH}} \tag{7}$$

Now, you can evaluate the derivative given above, and after some alebraic manipulations you get
$$\beta = (2.303) \left( \frac{K_w}{[\ce{H+}]} + [\ce{H+}]+ \frac{C_bK_a}{(K_a+ [\ce{H+}])^2} \right )$$

Generalising this for solutions containing several buffers

$$\beta = (2.303) \left( \frac{K_w}{[\ce{H+}]} + [\ce{H+}]+ \sum_{}^{} \frac{C_bK_a}{(K_a+ [\ce{H+}])^2} \right )$$

I'd like to point out that the first two terms in the buffer capacity formula are not dependent on the buffer presence in the solution. Why? They just tell us solutions of high (or low) pH are resistant to pH changes. Simple.



Above plot shows how the buffer capacity changes for the 0.1M solution of acetic buffer. As expected buffer exhibits the highest resistance to acid and base addition for the equimolar solution (when pH=pKa). From the plot it is also obvious that buffer capacity has reasonably high values only for pH close to pKa value. The further from the optimal value, the lower buffer capacity of the solution. Solution containing only conjugate base (pH 8-10) has buffer capacity of zero, for the higher pH presence of the strong base starts to play an important role. In the case of pure acetic acid solution (pH below 3) pH is already low enough to be resistant to changes due to the high concentration of $\ce{H+}$.