!(year % 4) in an arithmetic context would first take the result of
year % 4, yielding a value between 0 and 3. If the value is 0 (
year is a multiple of 4), then the result of the whole operation is 1 (
!0), otherwise it is
!3. These all evaluate to 0.
This is standard practice for integer boolean evaluation in most languages.
An operation such as
0 && 3 is false since integer zero is false under boolean arithmetic evaluation.
The exit code of the command
(( 10 > 6 )) is zero. This is different from what you get as output from e.g.
echo "$(( 10 > 6 ))" (which is 1). An exit code signal "success" or "failure". The test was carried out successfully, so it returns zero. Would you use the comparison in an arithmetic context, its value would be 1:
(( var = 10 > 6 ))
echo "$var" # prints 1
! outside of an arithmetic context works the same. It turns zero into 1 and non-zero into zero. The interpretation of this by the shell will be different though, with zero being "success" rather than meaning "boolean false" (this may not be a strange thing if you are more accustomed to thinking about shell utilities "not failing" rather than "succeeding").
grep -q -e PATTERN file && echo 'grep did not fail (and found PATTERN)'
! grep -q -e PATTERN file && echo 'grep failed (and did not find PATTERN)'
A zero return code signals "success" in Unix since no further information needs to be conveyed.
A failure is given by a non-zero exit code. The nature of the failure is conveyed by the actual value of the exit code. Valid failure codes are 1-127. The meaning of these should be documented in the utility's manual. Exit statuses above that are for when a utility is terminated by a signal.