The reason for including the punctuation is that text with math in it is still text. The reason for leaving it out is that it looks ugly because we're juxtaposing elements of two writing systems in which symbols have completely different meanings. Either possibility can be jarring to the reader.
A good way to deal with these problems is to leave some white space between the equation and the punctuation.
The Pythagorean theorem,
A^2+B^2=C^2 ,
has been known since ancient times.
In LaTeX, I use a \qquad for this.
In my personal style, I also sometimes end a sentence with a displayed equation set off by a colon, without a period after the equation.
Thus from Euclid's five postulates we arrive at our final result,
known as the Pythagorean theorem:
A^2+B^2=C^2
Here I feel that the colon acts like a signal on the tracks that tells the train conductor we're nearing the end of the sentence. The construction of the sentence also reinforces the reader's subconscious expectation that the sentence will not continue after the equation. Grammatically, the equation does not function as any part of speech; the style is similar to what one would use in introducing a diagram that was in-line in the body of the text and had no caption or figure number.