The best way to get a proper understanding is to write down the truth table completely. You have 3 inputs (A, B, S), so this will give you 2\$^3\$ = 8 combinations:
S A B | S' C D | Z
--------+---------+--
0 0 0 | 1 0 0 | 0
0 0 1 | 1 0 0 | 0
0 1 0 | 1 1 0 | 1
0 1 1 | 1 1 0 | 1
1 0 0 | 0 0 0 | 0
1 0 1 | 0 0 1 | 1
1 1 0 | 0 0 0 | 0
1 1 1 | 0 0 1 | 1
It's often useful to add intermediate results to make things more clear. I added a term C = (A \$\land\$ S') and D = (B \$\land\$ S). Now it should be clear Z = (C \$\lor\$ D).