Why is the mechanical power of a DC brushed motor at a maximum at around 50% of the stall torque?
It's because, for a DC motor, the torque curve and speed curve are both linear and of opposite polarity slopes and both curves also start and end at the same place. 100% torque = 0% speed, and 100% speed = 0% torque.
Those two facts mean that the adding them up will always equal 100%. Specifically, 50% of one corresponds to 50% of the other, and since power = torque x RPM, this just happens to be when the multiplication of the two is the maximum.
At one extreme end, you have 100% torque but 0% speed so the multplication gives you zero output power.
At the other extreme end you have 100% speed but 0% torque so the multplication again gives you zero output power.

Taken from:
https://www.vexforum.com/t/motor-torque-speed-curves/21602
Geometrically, it is identical to why a square is the rectangle with the most area if the sum of all sides is a fixed number. If one side is speed and one side is torque with power being the area, and the sum of length and width must be 100, a square of 50 x 50 gives the most area.