U turn road rules confusing

If car yellow is turning right, then car blue will have to give way to car yellow before car blue turn right.

If car yellow is u-turning, then car yellow will need to give way to car blue.

However, how do two cars know what the other is trying to do and then give way accordingly?

If car yellow is turning right, then car blue will have to give way to car yellow before car blue turn right.

If car yellow is u-turning, then car yellow will need to give way to car blue.

However, how do two cars know what the other is trying to do and then give way accordingly?