What is the function of R1 in this relay driver circuit?
That is not a pull-up resistor; it's a resistor to limit the base current in TR1. The base-emitter junction of a transistor looks like a diode to the microcontroller. As such, if you were to apply 3.5V to it without any other component to limit the current, the transistor would likely be destroyed, just as if you did the same to an LED or any other diode.

When the microcontroller applies 3.5V to this input, the base-emitter diode will be forward biased. Silicon diodes have a voltage drop of about 0.6V, so the current that will flow is:

\$ I_b = \dfrac{3.5V - 0.6V}{R_1} \$

The transistor will then allow the collector to pass \$ I_b \cdot h_{fe} \$ of current, or less if there is something else limiting the collector current. \$h_{fe}\$ is the current gain of the transistor, and will be specified in the datasheet. It varies quite a lot even among transistors of the same model, but 100 is a reasonable estimate.

When the collector current is limited by the load (RL1, in this case) and not by the base current (that is, increasing the base current can not increase the collector current), the transistor is said to be saturated or less precisely, on.

When the microcontroller applies 0V to this input, there's no way for base current to flow, so the transistor is off and allows no collector current.