I have recently become aware of the following neat statement.

Consider a convex polygon $P$ in the real plane with integral vertices. If we associate with every integral point $(a,b)$ the monomial $x^ay^b$ we then arrive at the Laurent polynomial $S(P)$ equal to the sum of corresponding monomials over all the integral points of the (closed) polygon.

Now consider the angles $A_i$ of our polygon, where by "angle" I mean a geometrical figure bounded by two rays with the same endpoint. In the same fashion we may consider the Laurent series $S(A_i)$. It turns out that, in a sense, $S(P)=\sum_i S(A_i)$ (briefly speaking, that is if one allows himself the formal application of the formula for the sum of an infinite geometrical progression and other natural arithmetic transformations).

My questions are, probably, addressed to those who are more familiar with this subject than I am. First of all: what is the proper (accepted) way of formalizing this? This is an identity between elements of what algebraic structure?

Second, I would like to put this in some sort of perspective. What is the proper name(s) for such theorems? What are the known generalizations here? I only know such formulas to hold for very specific polytopes I happened to work with, most of them in countable dimensional space. There is some continuous version concerning analogous integrals, isn't there?

Where does one read about all this?