I'm learning algorithms now, and while implementing red-black tree insertion I came up to the idea described in the question's header. This takes place when equal value nodes are involved.
Let's start with a simple example tree, where left children are less than the parent and right children are greater or equal to the parent.
Initial state of such tree might be the following:
Then, if I rotate this tree left, I get:
The node which violates the BST condition that all left children are less than the parent is shown in red.
So the question is: why lots of algorithms which implement insertion, deletion or else on binary search trees use rotation when rotations break BSTs (or do I just do the rotation wrong)?
The question is why you want to rotate your BST when it satisfies all conditions. The rotation in your example will not be implemented in any sense. In 'lots of algorithms', the rotation is only required when 'insertion' or 'deletion' or 'else' makes a new tree that violates BST properties. Lets say if you replace 6 by 8 as the root of BST, now your rotation will make sense.