Try the following steps, check whether things are working after each step where appropriate, before trying the next (you may have already tried some of these).
- Check AirPlay is turned on on the Apple TV (turn it off and on if it already is)
- Check that both devices are on the same network (Settings ➔ Wifi, on the mobile device and Settings ➔ General ➔ Network, on the Apple TV 2 & 3 and Settings ➔ Network on the Apple TV 4/4k).
- Restart the Apple TV (Settings ➔ General ➔ Restart on the Apple TV 2 & 3 and Settings ➔ System ➔ Restart on the Apple TV 4/4k).
- Restart the Apple TV by removing ALL the cables for 30 seconds.
- Restart your router. (Also try removing its power cord for at least 30 seconds)
- Restart your mobile device or computer.
If you are still having problems, try using 802.11n for wifi if you are currently using either 802.11b or 802.11g.
If your problem is AirPlaying from a computer, try disabling Bluetooth.
You might also try removing any other software related to screen sharing or streaming to remote displays that you might have installed at some time.
If you are still having problems, the following article(s) may help you.
Troubleshooting AirPlay
Troubleshooting Wi-Fi networks and connections
Recommended Wi-Fi settings
Wifi Diagnostic Software (for Mac users)
You may also find some help on this page, where I’ve collected some of the more unusual solutions to network issues.
When making adjustments to your network for better optimisation, you may find some of the points mentioned on this page helpful.