You need to rotate at the level where there is more than one height difference between the left subtree and the right subtree.
BEFORE INSERTING 21
16
/\
9 30
/ / \
4 23 34
/ \
20 26
AFTER INSERTING 21
16
/\
9 30
/ / \
4 23 34
/ \
20 26
\
21
Height difference of 2 at node 30. So rotate right at node 30.
AFTER ROTATION
16
/ \
9 23
/ / \
4 20 30
\ / \
21 26 34
There are single and double rotations. In your case a single rotation is enough. But this might not be the case every time. See how rotations work.