If you're trying to connect to your iPad, you also need to be logged into the same Apple ID account. When attempting to use AirPlay from a Mac to an Apple TV or other AirPlay-compatible device, the most common misstep is not having both devices connected to the same Wi-Fi network. You can also click "Use As Separate Display" to have your Mac screen cast its screen to your other device, rather than both devices displaying the same screen. Click the AirPlay icon in the menu bar and in the drop-down, select "Mirror Built-In Retina Display" to have your other device match what's on your Mac desktop. Quick tip: You can change how your Mac display is mirrored to another device.
Click "Off" in the drop-down to stop AirPlaying.