You seem to focus only on part of the case statement, and not the whole statement.

Evaluating the code with the year 2005:

when year(@d)%400=0 <--- this is not true, so we continue evaluating
when year(@d)%100=0 <--- this is not true, so we continue evaluating
when year(@d)%4 <--- this is not true, so we continue evaluating
else <--- this is true, so we return "no"