Why would a flight take a detour on clean weather? I was in a flight recently (march 22nd) from SBCF to SBGR (Brazil). It's usually a 1h10m flight, but mine took roughly 20 minutes more. I saw the flight path in FlightAware and there's an unexpected (to me) detour mid-flight:



I looked for other instances of this scheduled flight and there are more extreme cases, such as this one:



In this case, the actual flight distance was 833km whereas the straight-line distance is measly 496km.

Obviously it would be difficult to pinpoint the exact reason why this happened, but what factors could lead to taking such a different than expected route?
There are lots of reasons flights may not take a direct route, some are but not limited to: 


It's just the route ATC assigned (for whatever reason they see fit)
There is an active military operations area or live firing area they are avoiding, these are not always "active" and may be avoided only sometimes.
Some kind of natural event on the ground, wildfire, volcanic eruption, etc. 
There is a TFR they can't get through these are typically not hard bans on overflight but can be. 
If it's an international flight they may not be allowed to overfly the airspace. 
For smaller aircraft it may be a terrain avoidance issue (generally this is for general aviation sized planes).