In the 1960's, W. Kasteleyn showed that the partition function for the dimer model on a planar graph is equal to the Pfaffian of an N by N matrix, where N is the number of vertices of the graph. He also stated that for any graph G, the partition function can be written as a linear combination of 4^g Pfaffians, where g denotes the genus of a surface S where G can be embedded. A formal combinatorial proof of this fact was only given in 1999 by Gallucio-Loeb and Tesler. In this talk, we shall explain a geometric proof of this fact. In our formula for the partition function, each of the 4^g terms corresponds to a spin structure on S, and each coefficient in the linear combination is equal to the Arf invariant of the corresponding spin structure. This is joint work with Nicolai Reshetikhin.