The picture below says it all! Just place the earbuds near the spots indicated in the photo and they’ll stick to the screen.
It takes advantage of the fact earbuds contain magnets, and the MacBook Pro lid does too. This trick is perfect for storing your headphones while you’re away from your MacBook Pro temporarily, or even overnight if you normally leave the lid open. It should work with the new wireless AirPods too!