You can read an output or just store a copy in memory, either way you can tell what the relay should
be. But as you pointed out what if you have a manual switch that can change the relay state?
You can run the switch to the processor and let it make all the decisions. But there can be problems when you have a failure in the system and the processor decides it knows best about the relay's state.
You can have the switch manually control but also run a wire from the switch to the processor, likewise you can read this to see what state the relay should be in.
A relay is just a switch, a relay with one switch is called "single pole", a relay with two switches is called "double pole". You can use this to your advantage.
Get a double pole relay, use one pole to control the light and the other to feed back the relay state to the processor.
Now there is no real chance for confusion because the processor can read the relay state at any time.
You can (in fact should) also organize things so the button will work the light regardless of the processor, this gives you a backup for times when the auto system is not working (there will be many such times