What should the pilots do when fire is detected during the takeoff roll at high speed?
Before starting the takeoff, the pilots will have calculated at least 3 V speeds: V1, VR and V2. The important one for your question is V1, the takeoff decision speed. This is the critical speed that determines whether or not to reject the takeoff in case of a critical failure or other problems.
During the takeoff, there are 3 phases relevant for the decision of rejecting:

Until reaching 80 knots: At these relatively low speeds, you would reject the takeoff for any reason. Any caution message appearing or any failure you notice results in rejecting the takeoff.
Between 80 knots and V1: At these speeds, you would only reject for critical failures, like e.g. an engine failure or a fire warning.
At or after V1: At these speeds, you should never reject the takeoff unless the captain determines that the aircraft is unable to fly.

The details may depend on the exact aircraft, but here is the official list of reasons for rejecting for the Boeing 737 NG:

Prior to 80 knots, the takeoff should be rejected for any of the
following:

activation of the master caution system
system failure(s)
unusual noise or vibration
tire failure
abnormally slow acceleration
takeoff configuration warning
fire or fire warning
engine failure
predictive windshear warning
if a side window opens
if the airplane is unsafe or unable to fly.

Above 80 knots and prior to V1, the takeoff should be rejected for any
of the following:

fire or fire warning
engine failure
predictive windshear warning
if the airplane is unsafe or unable to fly.


(Boeing 737 NG QRH MAN 1.2 - Maneuvers - Non-Normal Maneuvers, emphasis mine)
As you can see, a fire or fire warning is serious enough that you want to reject up to V1. At or after V1, you should not reject for a fire warning. Rejecting a takeoff after V1 usually results in an accident, even if there is enough runway available, because the brakes may not be capable of stopping the aircraft any more:

Rejecting the takeoff after V1 is not recommended unless the captain judges the
airplane incapable of flight. Even if excess runway remains after V1, there is no
assurance that the brakes have the capacity to stop the airplane before the end of
the runway.

(Boeing 737 NG FCTM 3.23 - Takeoff and Initial Climb)