When your character dies, the soul of your character lives on in the spirit realm. You can move around as the soul (ghost) of your character and chat with other ghosts while spectating the round.
If you are lucky that your character's body may be revived then you can always re-enter your body and live as that character again/still.
If you do not believe that your character has any hope of living again, you can choose a ghost-role if there are any available.
Ghost roles refers to roles that are made available mid-game. Obviously players who already have a role and are still alive in the game have no reason to become a new roles. Only players who have died and become a ghost (or decided to spectate for other reasons) will be granted the option for these mid-game roles, hence their name "Ghost Roles".
Ghost roles can be any typical role like a crewmember, but they can also be antagonists or even simple characters like animals.