These variables are called "symbols", and during compiling a table is generated, the "symbol table". This table contains the name, type, scope and memory pointer to each symbol (this is like the minimum, you usually have a bunch of more stuff), and each time a reference is made to an symbol in a specific scope, it's substituted for an index into the table. These indices are unique, so is the combination of name+scope.
So in short, the names of the variables are simply decoration, internally the compiler works with a symbol table and indices into it. Statics are initialized during program startup by iterating through a table of pointers to them and putting the correct values in place.