how do I get my module to install a view? I have developed a module in a dev environment. I built a view for it using the UI. I've exported the view, but I don't know where to put it so that an installation of the module in a fresh environment will also create the view. 

How do I do this properly?

Bonus: how do I have the module uninstall the view on hook_uninstall?
Create the MODULENAME.views_default.inc file (replace MODULENAME with the name of your module), and copy the exported code in the implementation of hook_views_default_views() you write in that file.

For example, the Views module implements node_views_default_views() for the Node module. The relevant parts for the front page view are the following ones.

  $views = array();

  // Omissis

  $view = new view;
  $view-&gt;name = 'frontpage';
  $view-&gt;description = 'Emulates the default Drupal front page; you may set the default home page path to this view to make it your front page.';
  $view-&gt;tag = 'default';
  $view-&gt;base_table = 'node';
  $view-&gt;human_name = 'Front page';
  $view-&gt;core = 0;
  $view-&gt;api_version = '3.0';
  $view-&gt;disabled = TRUE; /* Edit this to true to make a default view disabled initially */

  // Omissis

  $views['frontpage'] = $view;


The hook then returns the content of $views.

If the view has not been overwritten by a user, it should not be shown in the view list, once the module implementing the hook is uninstalled.