Principles of logical punctuation were laid down by Fowler in 1906, in the large chapter on punctuation in The King's English. The Fowlers were very influential authorities, but their system did not take off. They warn at the time that "it is not the system now in fashion; but there are signs that printers are feeling their way towards better things". Even today there has been very little real progress, at least in books, against the tradition.

The conventional system is illogical in (1) its addition of unnecessary commas, (2) its placement of those commas, and (3) the disposition of multiple punctuation marks together. I shall restrict myself to quotation, though the placement of the dash is subject to similar perplexity.

Logically, these three should be treated consistently:

Susan said something.
Susan said her piece.
Susan said her actual words.
where her actual words are quoted directly, without alteration: that is My foot hurts. rather than her foot hurt. If she says a complete sentence it ought to be so marked, capital letter at one end and full stop at the other. Finally, we enclose direct speech in quotation marks. For clarity I'll use double quotes; the principles are equally applicable to single and double quotes, until you get to the complication of quotes within quotes - which I'll avoid. So substituting her actual spoken sentence in, we should write:
Susan said "My foot hurts.".
But no-one writes this. First, the convention is to introduce an extra comma, even though the quotation marks are clear (and even clearer in a book, where open quotes are different symbols from close quotes).
Susan said, "My foot hurts.".
Secondly, no-one is ever so logical as to write both full stops. Traditionally the first is kept and the second discarded.
Susan said, "My foot hurts."
I prefer to discard the first, since it doesn't matter whether what she said is written "My foot hurts." or "My foot hurts", and keep the second, which does close the whole sentence and separate it from the next:
Susan did this. Then she did that.
Susan said "My foot hurts". Then she rubbed it.
When the quoted words come first and the speech verb (she said or said she or whatever) follows them, here is what you would logically expect. Although the verb and subject may be inverted in this case (said she), I can't see that this makes any logical difference:
Thus said she.
her actual words said she.
"My foot hurts." said she.
What actually happens in the standard system is however that (i) the inner full stop is discarded, (ii) an unnecessary comma is added to separate speech from speaker, and (iii) it is added in logically the wrong place, inside the speech rather than after it:
"My foot hurts," said she.
We can remedy this by the principle adopted above that internal full stops are not necessary, and that the quotation marks are ample in themselves as separators. So what I would prefer to see is:
"My foot hurts" said she.
When the speaker is inserted within the speech, it attracts two commas out of the void, the first of which burrows inside the speech. This intrusive comma expels the full stop that belongs there if it happens to meet one, and the full stop goes off to close the "said" part.
"My foot hurts quite a lot."
"My foot," said Susan, "hurts quite a lot."
"My foot hurts. I shall rub it."
"My foot hurts," said Susan. "I shall rub it."
Logically these would be better like this:
"My foot" said Susan "hurts quite a lot".
"My foot hurts." said Susan "I shall rub it".
However, I think the second is too extreme. So we accept the compromise that splitting a quote of two sentences up creates two outer sentences:
"My foot hurts" said Susan. "I shall rub it."
I have also moved the final full stop in, because... er... well it's very hard to be consistent here and shake off the old system entirely. /me waves hands.

The comma and full stop are not integral to the reading of a sentence the way the question mark and exclamation mark are. These should always be arranged logically, and damn the habits of printers.

"Damn you!" shouted Susan.
Susan shouted "Damn you!".
Did Susan shout "Damn you!"?
Hey wow, Susan shouted "Damn you!"!
All right, one concession, in the second one the final full stop may be dispensed with. This accords with the usual convention:
Susan shouted "Damn you!"

Afternote. Other nodes on this subject have implied that British style is logical, and the illogical convention is now restricted to the US. This is not true. A quick glance at several of my more conversational books confirms that British and US usage are the same. I have never seen logical quoting used in any (print) book other than Fowler.

Åfter äfternøte. Actually the preceding is true only for quoted conversation. For small snippets like individual words, the US does use a less logical style, e.g.

(UK) The words 'and', 'if' and 'not'.
(US) The words "and," "if," and "not."