As others have said, the expression a, b in s creates a tuple, and a non-empty tuple is truthy, i.e., it evaluates to True in a boolean context. Note that the commas create the tuple, not the parentheses, although parentheses are required in some contexts to avoid ambiguity, eg when passing a tuple literal as a single function argument.
BTW, parentheses are not required around the condition expression of an if statement in Python. They don't hurt, but the usual style convention is to omit them as unnecessary clutter.
Note that if a and b in s: does not test if both a and b are elements of the set s. To perform that test you should use the set.issuperset method:
if s.issuperset((a, b)):
Note that we need the extra parentheses here because we are passing the tuple a, b as a single argument.
That statement can also be written using the operator form of .issuperset:
if s >= set((a, b)):
but when using that form both operands must be sets (or frozensets), whereas the full method will accept any iterable as the other arg.
But getting back to your code... The expression
a and b in s
is equivalent to
a and (b in s)
If a is false-ish (i.e., False, 0, or an empty collection) the expression evaluates to a and the second part of the and expression is ignored. Otherwise (when a is truth-ish) the second part of the and expression is evaluated and that becomes the result.
In other words, if a == 0 then a and b in s results in 0, but if a is any other number then a and b in s will result in True if b is in s, and it will result in False if b is not in s. Please see my answer to Assigning string with boolean expression for further info (with numerous examples).