The goal of my answer is to give you a series of hints and let you work out the exact calculations (I know, I'm lazy).
The main idea is that you can compute $a$ and $b$ by looking at these as the sums of roots of certain polynomials. As you know, the sum of the roots of a polynomial is related to its constant coefficient.
Let $n=12$. For $a$ you need to compute
$$\sum_{r=0}^{n-1}\tan^2\left(\frac {k\pi}{2n}\right) $$
So you'd like to find a polynomial whose roots are those squared tangents.
Start with $P(X)=(1+X)^{2n}-(1-X)^{2n}$.
Then any root $x$ of $P$ verifies $$(1+x)^{2n} = (1-x)^{2n}$$
or equivalently, $$\left( \frac{1+x}{1-x}\right)^{2n} = 1$$
which means that the roots $x_r$ verify $\frac{1+x_r}{1-x_r}=e^{i\frac{r\pi}n}$ for $r=0,...,2n-1$. In other words, the roots of $P$ are
$$x_r=\frac{e^{i\frac{r\pi}n} - 1}{e^{i\frac{r\pi}n} + 1}=\frac{e^{i\frac{r\pi}{2n}}-e^{-i\frac{r\pi}{2n}}}{e^{i\frac{r\pi}{2n}} +e^{-i\frac{r\pi}{2n}}}=\tan \left(\frac {r\pi}{2n}\right)$$
Now the first sum, $a$, uses the squares of the tangents, so $P(X)$ is not quite what we need. But $P$ only has terms of even degree, so you can write $P(X) = Q(X^2)$, and the roots of $Q$ are, $$y_r = \tan^2\left(\frac {r\pi}{2n}\right)$$
So by looking at the constant coefficient for $Q$, you should be able to compute $a$.
As for $b$, you can notice that you can separate the sum into two sums (the terms for odd $r$'s, and the terms with even $r$'s). The sum with odd $r$'s has the same form as the one we had for $a$, except that you need to replace $n$ with $n/2$.
The second sum (even $r$'s) can be deduced from the first one (odd $r$'s) and $a$ itself.