How to use select2 in form API drupal 7?
From what I recall, the select2 javascript needs to be #attached to a render node or otherwise included on the page, then the dom content loaded callback used to locate the HTML select items that should be modified. Something like:

function () {
  $('select').select2();
}


See https://select2.github.io/ for examples. Within Drupal, you should really use the Drupal 'behaviours' framework, so that the right thing happens when AJAX and other dynamic loading happens.

There is also the project https://www.drupal.org/project/select2 which may help!