member built-in predicate
This predicate takes a item and a list as arguments, and succeeds if the item is a member of the list:

?- member(a, [b, a, c]).

?- member(X, [b, a, c]).
X = b ;
X = a ;
X = c ;

?- member(happy(fido), [angry(rex), happy(fido)]).

?- member(a, [b, [a], c]).

?- member([a], [b, [a], c]).

?- member(a, Y).
Y = [a|_G310] ;
Y = [_G309, a|_G313] ;
Y = [_G309, _G312, a|_G316] ;
Y = [_G309, _G312, _G315, a|_G319] ;
… and so on for as long as you press ";". The response to this last query says that a is a member of an (uninstantiated) list Y if a is the first member or the second member or the third member or the fourth member or …
The variables _G309, _G310, _G313, etc. represent bits of the list Y that we have no information about.

See also backtracking.