Some remarks about punctuation within displayed math from the practice of professional typesetting :
Displayed equation usually are considered to be part of the preceding sentence, that is it will get the very same punctuation as if it was inline math: if the sentence ends in a displayed equation it gets a period, if a where … is …
or something like that follows, the equation is ended by a ,
, and so on.
For LaTeX-code, this means that there is never a blank line before any displayed math environment, unless you want to start a paragraph with a displayed equation for some reason. Accordingly, after the \end{}
there is only a blank line if the whole preceding paragraph ends with that very equation.
As for micro-typography, most publishers prefer a thinspace before any equation internal sentence-level punctuations. This holds for equation-final punctuation as well as punctuation within separable parts of an equation. By “sentence-level”, i mean punctuation that is not part of any mathematical expression. Elements of n-tuples, for instance, are separated by comma but these commas do not get any additional spaces. TeX itself considers bare punctuation inside math-mode to be mathematical symbols rather than sentence punctuation symbols; therefore, spacing around punctuation in math-mode is handled differently than spacing around their corresponding text-mode counter-parts.
The following screenshot covers some of the most frequent cases for spacing and punctuation within displayed math and how a typesetter would typeset them properly for most publisher's desires. This is how a professional typesetter would submit a document to the average publisher without causing reason for refund:

Some final words: After all it is a question of taste and concept whether or not displayed equations are part of the surrounding text and whether or not additional spacing is used to distinct math punctuation from text punctuation. When in doubt, imagine to substitute the equation(s) by a single symbol x
and figure out how you would add punctuation and ask your publisher about proper spacing.