The counterstrike wiki states the following in regards to spectating:
In Counter-Strike: Global Offensive, non-dead player spectators are
allowed to use the X-ray by pressing a key (default X). When turned
on, the team-colored silhouette of all players is shown through the
walls. For instance, a blue aura will display a CT player. Grenade
trails are also shown in their respective hues.
In casual matches, dead players are allowed to spectate both their
teammates and their enemies, as well as view in either first person,
chase cam or free cam. Team chat (both text and voice) is disabled
when the player spectates in this mode.
In competitive matches, dead players can only watch their teammates in
first person. However, unlike in casual mode, players can chat or use
their microphones to communicate regardless of their current status.
The HUD for non-dead player spectators in Competitive matches also
show the equipped weapon and equipments, health and armor for all 10
players.
In bomb defusal games (regardless of casual or competitive) if the C4
has been planted and the entire Terrorist team is dead, the spectator
view for dead Terrorist players will focus only on the C4. Also, when
spectating a competitive game, the C4 is outlined in yellow when
dropped, red if planted and green when defused.
In game modes that do not allow players to respawn, bots can be
controlled by their respective team members who were killed in the
same round. This has garnered some controversy, especially in casual
mode, as spectating players can see the enemy's position, take control
of a bot, and quickly eliminate opponents.
Recap
In casual play the text and voice chat are disabled to prevent cheating.
In competitive matches players can only see their teammates.