Can this determinant ever vanish?
For all $1\le k\le q$, define the simple continued fraction $$Q_k=a_k-\dfrac1{a_{k-1}-\dfrac1{a_{k-2}-\cdots}}:=[a_k;a_{k-1},\cdots,a_1]$$ and the product $P_k=(-1)^k\prod\limits_{i=1}^kQ_i^{-1}$. We have the following result.
Claim. The matrix $A_q$ is invertible if and only if $(Q_q-Q_{q-1})\prod\limits_{r=1}^{q-2}Q_r^2>Q_{q-2}$.
Proof: The recurrent row-echelon reduction $R_m'\equiv R_m-R_{m-1}Q_{m-1}^{-1}$ for each $1<m\le q$ yields $$\det A_q=\det\begin{pmatrix} Q_1 & 1 & 0 & 0 & \ldots &0& 0 & 1 \\ 0 & Q_2 & 1 & 0 & \ldots &0& 0 & P_1 \\ 0 & 0 & Q_3 & 1 & \ldots &0& 0 & P_2 \\ 0 & 0 & 0 & Q_4 & \ldots &0& 0 & P_3 \\ \vdots & \vdots & \vdots & \vdots & \ddots &1& \vdots & \vdots \\ 0 & 0 & 0 & 0 & \ldots &Q_{q-2}&1&P_{q-3} \\ 0 & 0 & 0 & 0 & \ldots &0& Q_{q-1} & 1+P_{q-2} \\ 1 & 0 & 0 & 0 & \ldots &0& 0 & Q_q+P_{q-1}\end{pmatrix}.$$ Performing $R_q'\equiv R_q+R_mP_m$ for each $1\le m<q$ means that the final row will be reduced to the form \begin{pmatrix}0&0&0&0&\ldots&0&0&S_q\end{pmatrix} where \begin{align}S_q&=Q_q+P_{q-1}+P_1+\sum_{r=1}^{q-2}P_rP_{r+1}-P_{q-1}(1+P_{q-2})\\&=Q_q+P_1+\sum_{r=1}^{q-3}P_rP_{r+1}\\&=Q_q-Q_1^{-1}-\sum_{r=1}^{q-3}\left(Q_{r+1}^{-1}\prod_{i=1}^rQ_i^{-2}\right)\\&=Q_q+a_1^{-1}-\sum_{r=1}^{q-3}\left((a_{r+2}-Q_{r+2})\prod_{i=1}^r(a_{i+1}-Q_{i+1})^2\right)\end{align} so that $\det A_q=S_q\prod\limits_{j=1}^{q-1}Q_j$. The determinant vanishes if and only if $S_q=0$.
After some fiddling, I've discovered something quite interesting about $S_q$. In PARI/GP, the code
a(k,q)=1+2*cos(2*Pi*k/q)
Q(k,q)=if(k<1,0,k==1,a(1,q),a(k,q)-1/Q(k-1,q))
S(q)=Q(q,q)+1/(a(1,q))-sum(r=1,q-3,prod(i=1,r,1/((Q(i,q))^2))/(Q(r+1,q)))
for(m=1,200,print(S(m)))
appears to show that for all $q\ge47$, the function $S_q$ is strictly increasing. In addition, it appears to converge to a value of $\approx2.903$.
Checking $q<47$ reveals that $S_q\ne0$ so $\det A_q\ne0$. Therefore, it suffices to show that $S_q-S_{q-1}>0$ for all $q\ge47$. The sum conveniently telescopes to achieve the equivalent inequality $$(Q_q-Q_{q-1})\prod_{r=1}^{q-2}Q_r^2>Q_{q-2}.\tag*{$\square$}$$
Just some thoughts:
Assume that $q\ge 5$ is a prime number. Then $$\det A_q = \sum_{m=0}^{\frac{q - 1}{2}} a_i \cos \frac{2\pi m}{q}$$ where $a_i$'s are all integers.
Fact 1: Let $m$ be a positive integer
such that $2m$ is square-free. Then
$\{\sin \frac{k\pi}{m} : ~ 1\le k \le \frac{m}{2}, \, (k, m) = 1\}$
is linearly independent over the rationals.
See: https://mathoverflow.net/questions/244558/linear-independence-of-sink-pi-m
By Fact 1, we conclude that $\det A_q = 0$ if and only if $a_0 = a_1 = \cdots = a_{\frac{q - 1}{2}} = 0$. Can we prove this is impossible?
Because of the $1$'s in the upper-right and lower-left corners, I didn't have any luck trying to derive a recurrence relation. But using Matlab, I was able to at least get the first several terms:
$q$ | $\text{det}\left(A_q\right)$ |
---|---|
$1$ | $3$ |
$2$ | $-4$ |
$3$ | $-1$ |
$4$ | $-7$ |
$5$ | $\frac{5-\sqrt{5}}{4}$ |
$6$ | $5$ |
$7$ | $12.95944337$ |
$8$ | $-5.05887450$ |
$9$ | $-12.24073273$ |
$10$ | $-26.54915028$ |
The latter four decimal expansions don't even appear in OEIS, so as saulspatz notes in the his comment, "pretty" closed-form expressions are unlikely.
In terms of asympotics, plotting the first 1000 terms shows an approximate exponential relationship:
$\begin{align}\left|\text{det}\left(A_q\right)\right|\sim \exp\left(\beta_0+\beta_1 q\right) \hspace{1 em} \text{where} \hspace{1 em} &\beta_0 = -0.0103 \pm 0.09\\ &\beta_1 = 0.2514 \pm 0.0004\end{align}$
$\text{sgn}\left(\text{det}\left(A_q\right)\right)$ also appears to be somewhat periodic; the sign changes every $3$ or $4$ iterations from $2\leq q\leq 1000$.
This is far from a complete answer, but I hope it's enough to serve as a branching off point.