Simply put, it's supposed to follow a constant flow/fanspeed curve but multiple stages and the mechanics of surging make it a lot more complex in practice.
The surge line slope on multistage compressors can range from a simple, single-parabolical [sic] relationship to a complex curve containing several break-points or even 'notches.' The complexity of the surge line shape depends on whether or not the flow limiting stage changes with operating speed from one compression stage to another; in particular, very closely matched stage combinations frequently exhibit complex surge lines... The surge line in many cases has an approximately constant value of Q/N [mass flow/fan speed]. In many multi-stage units, and especially in units which are controlled by variable inlet guide vanes, the surge line curves bend dramatically at higher flows and speeds.
Source: "Practical Aspects of Centrifugal Compressor Surge and Surge Control" by Meherwan P. Boyce (pdf)
So some of the shape comes from the curvature and irregular spacing of the constant speed lines, and some of the curve comes from adding in different stages.
Unfortunately, exact surge conditions are not easy to describe mathematically even if we know the properties of each stage in the compressor. There are things like multi-blade interactions and boundary layer effect that make things difficult really fast. These factors are so important because surge is not quite the same as a stall on compressor blades. Surge is a more complex unstable compressor flow resulting from stalls. Single blade stall, which isn't observed much in practice, will not cause a surge. Surge happens when the stall propagates across several blades due to blocked incoming air. There aren't easy,exact, and universal equations for this complex behavior unfortunately.