Team = A group of agents. They can be in the same department or in different departments. So agents in different departments can view tickets that they usually don't see since they don't have access to other departments, but since they are in a team they can see these tickets when the ticket is assigned to that team.
Group = A group defines what permissions an agent is having and which departments he/she can / cannot access.
Department = A department like it is present in your company, e.g. Sales department, support department, etc.
Hope these explanations help you understand the differences between departments, groups and teams.