How to pass an array from module to template file?
In form.

/**
 * Implements hook_theme().
 */
function YOURMODULE_theme() {
  $themes = array(
    'example' =&gt; array(
      'template' =&gt; 'templates/example',
      'arguments' =&gt; array('data' =&gt; NULL),
    ),
  );
  return $themes;
}


after this you can pass your data as


  return theme('example', array('data' => $data));


Refer this

And if want to use preprocess to alter data, see hook_preprocess_HOOK