This means that the Holy Spirit caused David to speak or write down what God said.
# through the mouth of your servant, our father David
Here the word "mouth" refers to the words that David spoke or wrote down. AT: "by the words of your servant, our father David" (See: [[rc://en/ta/man/translate/figs-metonymy]])
# our father David
Here "father" refers to "ancestor/"
# Why did the Gentile nations rage, and the peoples imagine useless things?
This is a rhetorical question that emphasizes the futility of opposing God. AT: "The Gentile nations should not have raged, and the peoples should not have imagined useless things" (See: [[rc://en/ta/man/translate/figs-rquestion]])
# the peoples imagine useless things
These "useless things" consist of plans to oppose God. AT: "the peoples imagine useless things against God" (See: [[rc://en/ta/man/translate/figs-explicit]])