if you put grid in a string, it is no more the variable but ... a string. Print your query to check.
you need to build your query using the variable grid, for instance
query = '"{}" = 1'.format(grid.name)
or (easier to read but more complex when you have many parameters)
query = '"' + grid.name + '"=1'
note that I put some " " around the field name for the query and I assume that your fields are numeric.
The second problem is that your field list will return all field by default (including OID and geometry). You should therefore specify that you want only the integer fields
gridlist = arcpy.ListFields ("G:\\Sara_hab_sp\\test\\grid50","*","Integer")
As a last remark, you could directly use your query with MakeFeatureLayer, this saves you one line of code (but it will depend on the rest of your code to see if it is useful or not).