By default when a session is created it is identified by some string called the session key. By default in PHP this is stored as a cookie under the name PHPSESSID. e.g. PHPSESSID=absuk44ocvs55mkp6eh1gh58q3
This key can then be used to load session information. Session information can be stored in e.g. a file.
The session id can be used/stored by the client in multiple ways. In PHP it seems that it supports use of the session in the URL but also in cookies. Though the cookies can also be disabled.
Do note that certain websites based on php might also store the related data in a other way than a file. e.g. some might store it in a database.
In most cases however some data is stored in a cookie which is used to track the user.
Your example code:
$_SESSION['login'] = 1;
Would require a session_start() before setting the variable.
This would either load the session (based on an existing valid session id) or create a new session (random session id, or passed session id depending on configuration).
The 'login' and value would be stored locally on the server.
The next time the client connects, the session id is read and the data stored in $_SESSION can be retrieved based on this session id.