You would say 'to everyone'. For example:
I said goodnight to everyone before I left the party. Here you are reporting what you said
However, if you are addressing everyone - speaking to them, don't use 'to'. For example,
Before I left the party, I shouted, "Goodnight, everyone!" Here, these are the exact words you said.