Yes, switching it in/out affects the sleep
But you have do differ between Generation IV or earlier or Generation V or newer.
Let's get through your sub-questions, as they describe the sleep state itself:
Is the duration of sleep determined when the Pokémon is put to sleep or is there a random check each round?
It's a hard set value when being put to sleep.
When a Pokémon gets affected by sleep, the game sets a sleeping duration with this effect.
- <= Gen IV: 2 to 5
= Gen V: 2 to 4
On every try for an attack the counter decreases by 1. If it's not 0, the Pokémon will sleep. If it reaches 0, the Pokémon will wake up in that turn. So maximum duration would be 4 rounds in the first case and 3 rounds in the second.
Could it be that the sleep round counter keeps counting even if the Pokémon is not currently in battle?
The counter itself exists, but it does not count towards 0. So it's "frozen" when not directly in battle.
The only way to get your Pokémon awake is then by items like the Pokéflute or various healing items.
Is there actually any evidence that switching a Pokémon affects the probability of it waking up after it's switched back in?
Yes and no. It depends on the generation.
- Until Gen IV the sleep counter just freezes when switching out your sleeping Pokémon. So if the counter begins at 4, you tried 2 attacks, it's 2. You're now switching it out and later switch it back again - it remains on 2.
- For Gen V and later on they decreased the maximum sleep duration by 1. But for tactical and competitive play it's still harder now, as for now the sleep counter always resets to the maximum value determined while getting the sleep status. The counter begins on 3, you tried 2 attacks, it's on 1. You're now switching and see there - it's back on 3.
I've got this from a German source, which is reliable. I try to find something similar on Bulbapedia. :)
//EDIT: I found something on Bulbapedia. Though it describes the change of sleep in the Generations, it's not that accurate on the counter itself and how this counter is set as the German source. In case of need you can use Google Translator for the German site. German to English is readable through that and, in addition, funny.