Let's call

the event that Annie succeeds in passing the test on the first try, and

the event that she passes on the second try. Let's also call

the event that she passes the test at all.
So Annie will pass the test if she passes on the first try, or she fails on the first try but passes on the second. So

where

denotes the complement of

, or a failure on the first test. These two events are disjoint; if Annie passes the first test, then there's no reason to take the test again. So, the probability of passing is the sum of the probabilities of either event occurring:

We're given that

. To find the remaining probability, we recall the definition of conditional probability:


In case it's not clear, the event

is the event that Annie passes the second test *on the condition* of not having passed the first one.
We're given that the probability of this occurring is

. We also know the probability that she fails the first test is

.
So, the probability that she passes the test overall is

The point of the diagram is to demonstrate that you only need to add the probabilities of the events on the probability tree whose "leaves" are labeled "Pass". If the path from the "trunk" of the tree takes multiple steps, you have to multiply all the probability along that path.