Consider flow over a cylinder. At a high enough Reynold's Number, the strength of the adverse pressure gradient becomes too large for the boundary layer to be able to remain attached to the cylinder. Hence, the fluid is decelerated to rest, and the flow eventually reverses at some point.
The image below shows the behaviour of flow at different Re:
At Re = 20, we see that the flow has separated. The separated flow produces two circulation regions just downstream of the cylinder.
I somewhat understand this is due to a velocity gradient between the reverse flow and the forward flow, which I believe is called a shear layer? Also, I have heard that an inflection point in the velocity profile leads to instability in the flow (i.e. the flow is unstable to random disturbances) which leads to the production of vortices at higher Re.
So my question can be split into 2 parts:
1) Why does the velocity gradient lead to vortex formation in the separated flow over a cylinder?
2) More generally, why do velocity gradients lead to formation of vortices in any flow? (Cavity flows, mixing layers, etc.)