In this paper we present a general unifying principle for computing finite trigonometric sums of types that arise in physics and number theory. We obtain formulas that are more general than previous expressions and deduce linear recursions, which are computationally more efficient than the degree two recursions proved by Zagier. As an application, we provide an answer to a question recently posed by Xie, Zhao and Zhao concerning special values of Dirichlet L-functions. The proofs use the combinatorial Laplacian on cyclic graphs and their twisted coverings. The techniques therefore connect the trigonometric sums to spectral invariants of graphs and open up for future investigations.