The first example doesn't need a localizer to specify it is 'in' a location
今年夏天我在北京学习中文。- it doesn't need a localizer to indicate it is in Beijing -- no one would think it is in front of or above the city
The second two examples also stating an unspecified location
我刚到美国的时候只能在餐馆打零工 - It can be any restaurant; no one would think it is in front of or above a restaurant, so a localizer is not needed
他不在餐馆打工了 - It can be any restaurant, and no one would think it is in front of or above the restaurant, so a localizer is not needed
The next three examples stating a specified location
我要在CSE上贴我的问题 - CSE is a specific website
If you wrote 我要在 Facebook 上贴我的问题. That would imply you are posting your question on your own Facebook page
If you wrote 我要在 Facebook 贴我的问题, then it could mean you are posting on anyone's page on Facebook
他写了一个便条在门上 - '上 (on)' in "writing a note on a door" is required to indicate it is on the surface specifically,
他貼了一个便条在门後 - '後 (behind)' in "posted a note behind the door" is required to indicate it is behind the door specifically
他藏了一張便条在门內 - '內 (inside)' in "he hid a note inside the door" is required to indicate it is inside the door specifically
商店里的服务员对顾客都非常客气 - If you wrote 商店的服务员对顾客都非常客气, it could mean all or any store
In conclusion: You need a localizer when you need to indicate a specific location (e.g. in, on, behind, or above a door); you don't need a localizer when you don't need to indicate a specific location (e.g. '在北京' can only mean 'in Beijing')
More examples:
'在北京上空出現 UFO' cannot be reduced to '在北京出現 UFO' (that would imply UFO is found in the city)
'在天空出現 UFO' doesn't need '裡' to indicate it is in the sky, but you can still write '在天空上出現 UFO' to stress it is 'the sky above' or '在天空中出現 UFO' to stress it is in the middle of the sky