All of the times the word "they" is used and the first time "them" is used, the words refer to the magistrates. The word "themselves" refers to the magistrates. The second time the word "them" is used, it refers to Paul and Silas.
The word "us" refers only to Paul and Silas. (See: [[rc://en/ta/man/translate/figs-exclusive]])
Probably Paul is speaking to the jailer, but he intends for the jailer to tell the magistrates what he says. AT: "said to the jailer" (See: [[rc://en/ta/man/translate/figs-explicit]])
Here "They" refers to the magistrates who commanded their soldiers to beat them. AT: "The magistrates ordered their soldiers to beat us in public" (See: [[rc://en/ta/man/translate/figs-metonymy]])
Paul uses a question to emphasize that he will not allow the magistrates to send them out the city in secret after they had mistreated Paul and Silas. AT: "I will certainly not let them send us out of the city in secret!" (See: [[rc://en/ta/man/translate/figs-rquestion]])