how to use spectator mode 1.18 Minecraft Servers

how to use spectator mode 1.18 Minecraft Servers