Your optical connection supports either 2 channel PCM or a compressed Dolby Digital or DTS stream with up to 5.1. Some games have Dolby Digital or DTS audio, though most do not. This is likely why you can get 5.1 with some games but not others.
Some sound cards and onboard motherboard audio support Dolby Digital Live and/or DTS Connect, which will encode your audio real-time to a compressed Dolby Digital or DTS stream. However, as this compression is lossy, you may notice a decrease in sound quality. Not all sound cards support this feature, so you may be out of luck in that regard.
My experience with multi-channel audio from the PC is that if Windows is configured for 5.1 or 7.1 sound, it will output 5.1 or 7.1 channels all the time; when you play a stereo source, you're actually getting 5.1 or 7.1 channels, it's just that most of them contain silence because your source material only contains audible information for two channels.
Assuming your Realtek drivers are installed, you should have an option in the Realtek control panel for "virtual surround" or some such option, which will produce additional channels from whatever audio source you are listening to. My experience with this, however, is that Realtek does a very poor job with its surround effect.
I'm not familiar with the Z5500, but it may be able to produce its own surround effect for the additional channels. You may have to change your audio settings in Windows for it to work properly. For example, if I want to use the 7 channel stereo mode on my receiver, I have to set Windows to 2 channel audio because my receiver will only apply the 7 channel stereo mode to a stereo source. If Windows is set to 5.1 or 7.1, my receiver will recognize the output as 5.1 or 7.1 even though most of the channels are silent.
What you should take away from this is that you will likely need to use the analog connections to get 5.1 audio from most games. You will also likely need to change the audio mode of your speakers and Windows to match the content you're playing because it is unlikely that any one combination of settings will produce the end result that you're after.