What exactly is SQL Server doing?
Under the covers, SQL Server will return the entire rowset from the SELECT, and then assigns every value (really quickly) to the variable. Of course, the last value in the SELECT will be what is finally assigned.

Here's where it gets tricky. The order of what is returned, with no WHERE or ORDER BY clause, can depend on any number of conditions. Usually it's returned in the order of the clustered index, but that's not guaranteed.