when disconnection USB and reconnection the serial output does not reappear

My issue can be illustrated by this trivial code

void setup() {
 Serial.begin(9600);
}
void loop() {
 Serial.println("Hello");
 delay(3000);
}

When I upload the code, and open serial monitor, everything works as it is supposed to, every 3 seconds, I get a new line with Hello. But when I disconnect arduino from the USB port of the computer and then connect it again, and open serial monitor, there is no output. THe only way to get output is to upload the code again. Note that the arduino is working correctly, which I see in a more complex code that actually does something (blinking a led eg.).
Why is that? Is this behaviour normal? How would I then make sure that for example if I connect RPI to USB to obtain data from sensor via serial port, that I actually get any data even after power has been reset to arduino?

Instead of uploading the code again, try closing and reopening the serial monitor window. I don't know why the serial monitor will not reconnect after a power down, but it won't. If you don't power the processor down, but reset the Arduino (with the reset button) serial monitor will not disconnect and the serial will continue to be displayed in serial monitor.

I think you will get what you want by using a proper terminal programme like RealTerm, instead of the serial monitor. With an Arduino, all you need do is ensure data is transmitted to the serial port whenever power is applied, which the above code does. I assume RPi is the same. I think the serial monitor is working normally, and there is probably good reason for working that way, but I don't know what it is. Since there is a swag of kosher terminals available, all much the same and all for free, there is no good reason for using the serial monitor as a terminal, and all the shortcomings of the serial monitor are easily avoided.