Double check to make sure that both your Mac and Apple TV meet the minimum system requirements.
Full system requirements are available from Apple here.
Make sure your device is connected to the same Wi-Fi network as your Apple TV.
The issue may also be your firewall. To change your firewall settings:
- Select the Apple menu (top left) and go to > System Preferences, then click Security & Privacy
- Click the lock icon, then enter an administrator name and password
- From the firewall tab, click on “Firewall Options”
- Make sure “Block All Incoming Connections” is not selected, and “Automatically Allow Signed Software to Receive Incoming Connections” is selected