How can I render form elements?
In Drupal 8+, you do not need to use a separate theming function as was required in Drupal 6. You can put the form element directly into the table without rendering, and Drupal will handle that on the back-end. It's much simpler:
$row = [];
$row[] = [
  'data' =&gt; [
    'something' =&gt; $form['something'],
    'something_else' =&gt; $form['something_else'],
  ],
];

$rows[] = $row;