How to disable "turn off display after" when using Apple TV?
You can keep your Mac on forever when you need to (including while AirPlaying) without digging into settings if you download the Mac app Amphetamine. With Amphetamine, a button will appear on your Mac's menu bar. Just click it to prevent your Mac from sleeping indefinitely, and click it again to allow it to sleep. This is a very simple method of keeping your Mac on forever, especially useful while downloading a large file or—like you're doing—AirPlaying.

Alternatively, you can use macOS's built-in command line tool caffeinate to keep your Mac awake for longer periods.