How to execute custom code on user signup I need to do a REST request every time a new user signs up. 

The REST request returns some data that I need to store for the Drupal user account, and be able to present as content somewhere.

What is the best/cleanest way to do that?
You can do it in a simple custom module, be sure to first understand Drupal hooks system as this is the base for (almost) everything Drupal.

In your module, you can implement hook_user_presave() to be called before a user account is saved. It will be called for both creation and update, so you will need to guard your code with a condition to detect new user. After the REST call, there is several option to store the returned data. The easiest one is the use the data attribute of the user account. It is a simple PHP array that will be serialized in a database columns. It is not very good performande wise and not very flexible (you can query the stored data) but it is easy.

function MODULE_user_presave(&amp;$edit, $account, $category) {
  // Accoding to user_save's documentation, this is a new user if
  // $account-&gt;is_new is set to TRUE or if $account-&gt;uid is not set
  if ($category == 'account' &amp;&amp; (!empty($account-&gt;is_new) || !isset($account-&gt;uid)))) {
    $edit['data']['MODULE'] = MODULE_get_data_from_rest($account);
  }
}