Basic question with respect to Drupal form API
The HTML produced from the first function (the form builder) can be roughly seen checking the code for the theme functions, which are at least two: theme_textfield(), and theme_form(). The exact output can change basing on the theme being used, and third-party modules installed on the site.

For the validation handler, the function that adds the class for form fields with a validation error is _form_set_error(), while the list of the validation error messages are set with form_set_error(), which uses the following snippet:

  if ($message) {
    drupal_set_message($message, 'error');
  }


The messages that are set with drupal_set_message() are then output with theme_status_messages().

Also in this case, the real output depends from the theme being used, and from other modules installed on the Drupal site; both can alter the output used for the rendering.