Push notifications from Gmail, YouTube and most other apps run through Google Play services. In the background, Play services keeps a connection open to Firebase Cloud Messaging, or FCM, which is Google's push service. When a new email arrives, Google sends a signal down that connection, and that is what makes your phone show the alert.