It actually depends on where the engine is housed and aerodynamics of the car.
For example, most single seat race cars have the engine at the back and hence it is easier to design the exhaust go straight out back rather than the sides.
Some cars have the exhaust on the sides, again this could be due to aerodynamic design and weight considerations.
Adequate fume and heat control are important in a vehicle participating in a 24 hour endurance race, not a big concern in something making a 3 second 1/4 mile pass.
If the engine is in front, you want the pipes long enough that they exhaust behind the driver, and no longer. While you can go too short with the pipes, in general shorter is better for power production.
If you run the pipes on the outside by the rocker panels, the hot pipes aren't under the drivers seat, making for a cooler cabin. You also don't have to choose between a straighter exhaust pipe and the best place to put a chassis cross member, or driveshaft.
With mid or rear engines, keeping the fumes and exhaust heat out of the cabin is a lot easier, it's all happening behind you. So the constraints become minimizing aerodynamic impacts, (both gas flow inside the system, and air flow around the rear of the vehicle) and keeping it away from anything that would react badly to having something glowing bright red in close proximity.
Another point to consider is that the hot exhaust gases also assist in providing aerodynamic grip advantage if designed with the help of a rear diffuser.