Could you give me a hint on how to code that?

You compute the absolute value of the difference between the current position and the middle of the range:

int midPoint = (MAX_RIGHT + MIN_LEFT)/2; // 525

int delta = abs(headRot - midPoint);

Then, map that difference to the desired speed value:

int maxVal = MAX_RIGHT - midPoint; // 750 - 525 = 225

int speed = map(delta, maxVal, 0, minSpeed, maxSpeed);

The minSpeed and maxSpeed variables need to be declared and valued before this code. The minimum will, presumably, be 0 and the maximum will be whatever you think appropriate based on you hardware.

When the value in delta is largest (the actual position is at the left or right limit), the mapping will result in the smallest value in the to range (minSpeed). When the value in delta is smallest (the actual position is at the midpoint), the mapping will result in the largest value in the to range (maxSpeed). So, you will be going fastest in the middle and slowest on the ends.

It might be necessary to constrain headRot to be in the range MIN_LEFT to MAX_RIGHT, and set the minimum speed to be something other than 0, so that if an overshoot occurs, the device will slowly rotate back to the correct position, rather than just stopping.