Drupal's theme system is built around hooks and hook suggestions. The element definition of the email input element defines the input__email theme hook. If there is no input__email hook implemented through a Twig template or PHP function, it will step down to just input.
A processor, such as Drupal's theme layer, passes variables to Twig. Variables or properties of objects can be printed by wrapping the variable name with curly brackets. All of Drupal core's default templates provide information in the file's document block that details the available Twig variables.
Twig has a simplistic syntax with basic logic and functions. The addClass method will take the attributes variable and add the class provided in addition to the existing contents.
When providing a theme hook suggestion or altering an existing template, you will need to rebuild Drupal's cache. The compiled Twig template, as PHP, is cached by Drupal so that Twig does not need to compile each time the template is invoked.