If you are using lr-stella- select+start on your joypad or select on your joypad and ESC on your keyboard. If you’re just using Stella press tab to open the config menu and I think there is an option to exit from there.
There are two emulators. Libretro-stella and just Stella (which libretro Stella is a port of) default is stella I believe. Thr other uses retroarch configs. You can change the default emulator by pressing a key on the keyboard or js0 on your joypad as your ROM loads (assuming you’re running retropie 3.0- if you aren’t you should look into updating.) If you have a joypad plugged in it overrides the nulbinding of the keyboard and you need to use the joypad hotkey (default select) in order for ESC on the keyboard to work to exit.