This answer has a good approach to calculating the average between multiple angles: simply convert each angle to its unit vector, add them up and convert the resulting sum vector back to an angle. The beauty of this approach is its straightforwardness – no special handling is needed for cases such as (350°, 10°), and unless the unit vectors cancel each other out, it will obtain a result even for less obvious cases such as (0°, 70°, 140°, 210°, 280°).
Now what do I do if I need a weighted average? Let's say I have two angles: 0° with a weight of 2, and 90° with a weight of 1.
If I use the previous approach and simply multiply the unit vectors with the respective weight, I would get 26.57° as a result – though I would expect the result to be precisely 30°.
So what is the correct approach?
The intended usage for this is to average between bearings with different confidence levels – say, one source reports a bearing of 90° (+/- 60°) and the other reports 0° (+/- 30°).
Convert angles to arclength parameter $s$ and do averaging on $s$ instead of the unit vectors.