What happens to your stuff related to a game if access is revoked?
I mean hours, screenshots, achievements and all that stuff.
I’m asking because I’m currently testing a game and the devs plan to revoke all the testing keys given out for free. So I would lose access temporarily. Is it just hidden until you regain access, or is it completely gone?
If you're worried about screenshots, those are stored locally and can be moved elsewhere. You can access your screenshots folder by opening Steam, under View > Screenshots > Choose your game from the drop down > Show on Disk.
But, if the devs decide to remove the game from Steam, or if Steam themselves choose to remove a game (ex. if servers are offline for a multiplayer only game, Steam and Square Enix did this for a standalone multiplayer expansion to one of their games), then one would assume your achievements and playtime would not stay either. Those stats are likely buried in Steam somewhere, but accessing them from the Steam interface is likely impossible.
The other notable scenario is when Steam bans a game from their platform, like in the case with the horror game Devotion. If you purchased it while it was available on the store, it's still in your Library, but you cannot buy it anymore.