Ansi_nulls ON - a comparison with NULL records yields UNKNOWN. Hence, no rows are returned. If you compare anything with NULL, it will result as UNKNOWN, and also the NULL = NULL comparison will be considered as UNKNOWN. You cannot compare NULL against anything.
Ansi_nulls OFF - then the query will return the values.
then a comparison with NULL records returns rows as a comparison that evaluate to TRUE instead of UNKNOWN. This is overriding the ISO behavior. With ANSI_NULLS OFF, the comparison with NULL records results in TRUE; hence, records are returned. When the ANSI_NULLS OFF database option is used, SQL Server consider NULLs as special values when comparing with other records.