Sally (the mayors daughter) donated to the Salvation Army yesterday.
Sally, the mayors daughter, donated to the Salvation Army yesterday.
Beware that the one with the brackets is an incorrect way of "saying" (typing) a sentence.
There are 2 options here. Option 1:
In this situation, "the mayor's daughter" part defines exactly which Sally you are talking about. Therefore it's implied that there is more than one Sally and you are specifying the correct one.
In this situation, "the mayor's daughter" part simply adds an additional info about Sally, which isn't required for the sentence to work, because there is only one Sally, or the specific one is already specified by any previous info in the text.
Generally you use commas in formal English. Programmers like to use parentheses (or even nested parentheses) but they are special.