The compiler will start to compile each source file independently.
When it comes to a static variable it stores it in the .bss or .data section depending on if its initialised or not.
all the segments of all the objectfiles are put together to something which is called a program memory map if your main function is calling a function of another source file the address of the called function will be a 'dummy' adress which gets replaced during the linking process.
Static variables arent exported to the linker that's the reason why no other source files can acces the static variable of another source file because the linker can't see it. So imagine the compiler wouldn't throw an error during the compilation process it would throw an error when all the object files get linked together.
If you want to try it out step by step
compile two source files to object files with
gcc -c source1.c -o object1.o
gcc -c source2.c -o object2.o
And then link it together with
ld object1.o object2.o
If you want to see that static is just a keyword for the linker you can do it like that
Give source1.c a header file of source2.c with a variable or array called test but without the keyword static. in source2.c you define the same variable with the keyword static
please don't include the header of source2.c in source2.c itself. And then do the three steps again
You should get a linker error when you call ld