If an engine failure occurs above V1 the aircraft can accelerate to the Vr and take-off, retract gear and accelerate to V2 and pass the end of the runway at a height of at least 35 feet. From there, flying at V2 or above the aircraft can climb at angle that keeps it clear of nearby obstacles.
Part of the aircraft's certification is to demonstrate that this is possible.
This question is related to the exact requirements.
To determine the minimum runway length required, two scenarios are calculated. The first scenario has the aircraft accelerating to V1, suffering an engine failure at V1 and then aborting the take-off. This gives the Accelerate - Stop Distance Required (ASDR). The higher V1, the higher the ASDR.
The second scenario has the aircraft accelerating to V1, suffering an engine failure at V1 and then continuing the take-off. This take-off involves accelerating from V1 to Vr, lifting off, retracting gear while accelerating and climbing, reaching V2 and 35 feet at the end of the runway. The runway length required for this scenario is the Take-Off Distance Required (TODR). The higher V1 the lower the TODR. This because when V1 is higher the part of the scenario that involves accelerating on a single engine becomes smaller.
These calculations take into account aircraft weight, engine thrust, aircraft configuration and runway condition.
For the V1 that gives the same ASDR as TODR, the required runway length is shortest. This is called the balanced field length.
This video is an example of an engine failure between V1 and V2. While the aircraft is rotating the engine ingests a heron resulting in big balls of fire. The aircraft lifts of, accelerates and climbs away at angle steep enough to avoid obstacles.
Rejecting a take-off above V1 will likely result in a runway excursion.