By definition of conditional probability,
P(sum is 5 | sum is not 6) = P(sum is 5 AND sum is not 6) / P(sum is not 6)
There are 4 ways of rolling the dice to get a sum of 5 out of 36 possible outcomes:
(1, 4), (2, 3), (3, 2), (4, 1)
so P(sum is 5) = 4/36 = 1/9.
There are 5 ways of getting a sum of 6 out of 36 possible outcomes:
(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)
hence 31 ways of *not* getting a sum of 6, so P(sum is not 6) = 31/36.
The sum is 5 and *not* 6 simultaneously for the 4 ways already listed above, so the intersection of these two events is those 4 ways, which means
P(sum is 5 AND sum is not 6) = 1/9
Then
P(sum is 5 | sum is not 6) = (1/9) / (31/36) = 4/31