Is there a variable in org I can use to specify the number of empty lines before the results block; it defaults to 1, but I want to set it to 0.
While it is true that the newline is hard-coded, you can still remove it by advising
(defun my-remove-line (_a _b) (save-excursion (previous-line) (beginning-of-line) (when (looking-at-p "\n") (kill-line)))) (advice-add 'org-babel--insert-results-keyword :before #'my-remove-line)
This might break things elsewhere though. If it does, maybe you can adjust the advice to prevent that, or you can remove the advice again using
(advice-remove 'org-babel--insert-results-keyword #'my-remove-line).