Find determinant of an almost diagonal matrix except first row and column $$\begin{vmatrix}
0 & 1  & 1  &  & 1\\
1  & a_1 &   &  & \\
1  &   & a_2 &  & \\
\vdots &  &  & \ddots & \\
1  &  &  & & a_n
\end{vmatrix}$$
If I suppose $a_1,\dots ,a_n\ne0$, I know how to do it, multiply the $i$-th column by $-1/a_i$ and add to the first column. Doing that I get the correct solution $ -a_1a_2 ...a_n(1/a_1+...+1/a_n)$.
How to avoid the zero case ?
 A: If $a_k = 0$, then we row expand on $(k+1)^\text{th}$ row and we get:
$$\left|
\begin{matrix}
0 & 1 & 1 & \cdots & 1 & 1 & 1 &\cdots & 1 \\
1 & a_1 & 0 & \cdots & 0 & 0 & 0&\cdots & 0 \\
1 & 0 & a_2 & \cdots & 0 & 0 & 0&\cdots & 0 \\
\vdots & & & \ddots & & & & & \vdots \\
1 & 0 & 0 & \cdots & a_{k-1} & 0 & 0 &\cdots & 0 \\
1 & 0 & 0 & \cdots & 0 & a_k & 0 &\cdots & 0 \\
1 & 0 & 0 & \cdots & 0 & 0 & a_{k+1} &\cdots & 0 \\
\vdots & & & \ddots & & & & & \vdots \\
1 & 0 & 0 & \cdots & 0 & 0 & 0 &\cdots & a_n \\
\end{matrix}\right| 
=
(-1)^{k + 1}\left|
\begin{matrix}
1 & 1 & \cdots & 1 & 1 & 1 &\cdots & 1 \\
a_1 & 0 & \cdots & 0 & 0 & 0&\cdots & 0 \\
0 & a_2 & \cdots & 0 & 0 & 0&\cdots & 0 \\
\vdots & & \ddots & & & & & \vdots \\
0 & 0 & \cdots & a_{k-1} & 0 & 0 &\cdots & 0 \\
0 & 0 & \cdots & 0 & 0 & a_{k+1} &\cdots & 0 \\
\vdots & & \ddots & & & & & \vdots \\
0 & 0 & \cdots & 0 & 0 & 0 &\cdots & a_n \\
\end{matrix}\right| 
$$
Row expand the matrix on the right (starting the bottom row), and you should get the determinant being $(-1)^{k+1}(-1)^ca_1 \cdots a_{k-1}a_{k+1} \cdots a_n$ for some integer $c$.
A: I'll abuse notation and use $a_{i,j}$ for the $i,j$ entry of $A$.
$$\begin{vmatrix}
0 & 1  & 1  &  & 1\\
1  & a_1 &   &  & \\
1  &   & a_2 &  & \\
\vdots &  &  & \ddots & \\
1  &  &  & & a_n
\end{vmatrix}=\sum_{\sigma \in S_n} \epsilon(\sigma) \prod a_{i \sigma(i)}$$
Now, consider each $\sigma \in S_n$.
Case 1: If $\sigma(1)=1$ then $\prod a_{i \sigma(i)}=0$.
Case 2: If $\sigma(1)=i$ and $\sigma(j)=1$ for some $ j \neq i$ then  $\sigma(i) \neq 1,i$ and hence $a_{i \sigma(i)}=0$. In this case 
$$\prod a_{i \sigma(i)}=0$$
Case 3: If $\sigma(1)=i$ and $\sigma(i)=1$ then, $\prod a_{i \sigma(i)} \neq 0$ if and only if $\sigma(k)=k$ for all $k \neq 1,i$.
The above analysis shows that 
$$\prod a_{i \sigma(i)} \neq 0 \Leftrightarrow \sigma = (1,k) \mbox{ for some } 2\leq k \leq n$$
Therefore, as $\epsilon((1,k))=-1$
$$\begin{vmatrix}
0 & 1  & 1  &  & 1\\
1  & a_1 &   &  & \\
1  &   & a_2 &  & \\
\vdots &  &  & \ddots & \\
1  &  &  & & a_n
\end{vmatrix}=\sum_{2 \leq k \leq n} (-1) \prod_{i \neq k} a_{i}$$
A: It suffices to note that your determinant must be a polynomial on $a_1,\dots,a_n$.  The only polynomial that is equal to $-a_1a_2 ...a_n(1/a_1+...+1/a_n)$ whenever $a_1,\dots,a_n$ are all non-zero is
$$
p(a_1,\dots,a_n) = -\sum_{i=1}^n \prod_{j \neq i} a_j,
$$
which is probably what you suspected. So, the determinant of your matrix must be equal to $p(a_1,\dots,a_n)$.
