How do I dynamically populate a select field? this question comes quite often but I couldn't make it work to that point.
My problem is simple, I have a 2 level taxonomy, I have 2 select fields, one is populated with the parent taxonomy and the second should be populated by its children when one parent is selected.

But I'm a bit confused. I followed the developer example with the check-boxes, but still. Also, this happens in hook_form_alter() and since I'm quite new to Drupal 7, I have to set the options with the ['und'] prefix, but that also troubles my mind because when I omit the ['und'] part when I try to save the node, an error says Illegal choice.

This is my first select field.

  //Field TYPE
  $form['field_type']['und']['#options'] = std_to_array($vocabulary_nudge_all);
  $form['field_type']['#ajax'] = array(
    'callback' =&gt; 'ajax_nudge_taxonomy_selected_callback',
    'wrapper' =&gt; 'select-target-div',
    'method' =&gt; 'replace',
    'effect' =&gt; 'fade',
  );


This is the AJAX callback function where I tried to get the field_type value, but I read somewhere that I couldn't use $form_state in a form hook. 

function ajax_nudge_taxonomy_selected_callback($form, $form_state) {
  return $form['field_target_select'];
}


Using $form, all I could think of was using #delta.

$selected = $form['field_type']['und']['#delta']


In the second select with a prefix, a suffix, and a visible condition, I am using the following code.

//Field Target SELECT
$form['field_target_select']['#weight'] = '0';
$form['field_target_select']['#prefix'] = '&lt;div id="select-target-div"&gt;';
$form['field_target_select']['#suffix'] = '&lt;/div&gt;';
$form['field_target_select']['und']['#options'] = std_to_array($vocabulary_nudge_all);
$form['field_target_select']['#states'] = array(
  'visible' =&gt; array(
    ':input[name="field_type[und]"]' =&gt; array(
      array('value' =&gt; 'carroussel'),
      array('value' =&gt; 'vitrine'),
    ),
  ),
);


I know there would be a solution by creating several select fields with visible conditions, but later more taxonomy fields could be added.

Right now it's not even doing the AJAX call anymore, and I can't manage to fix this, so any help would be appreciated.
I read somewhere that I couldn't use $form_state in a form hook


Not quite. If hook_form_alter() is being executed for the first time, then yes, $form_state can't be used to get a field's value because $form_state['values'] will not be set. 

However, if hook_form_alter() is being re-executed, like from an #ajax callback, then $form_state['values'] will be set with the current form values, just like it would be in #submit[] and #validate[] functions. By the way, the $form['#validate'][] functions are also executed during an #ajax callback. 

In your case, I believe you would get the current value of field_type from $form_state['values']['field_type'][LANGUAGE_NONE][0] (best to use the constant LANGUAGE_NONE instead of the string 'und'). Wherever you build the #options array for field_target_select during the execution of hook_form_alter(), you would do something like this:

$selected = 'some_default_value';
if (!empty($form_state['values']['field_type'][LANGUAGE_NONE][0])) {
  $selected = $form_state['values']['field_type'][LANGUAGE_NONE][0];
}
$child_options = my_function_to_get_child_options($selected);
$form['field_target_select'][LANGUAGE_NONE]['#options'] = $child_options;


What you have as your ajax callback function in your question looks correct:

function ajax_nudge_taxonomy_selected_callback($form, $form_state) {
  return $form['field_target_select'];
}