Scrum Master roles in an organisation
What does a scrum master really do?
There is a lot to say for this, but some of the straight forward things a Scrum Master do is to ensure that all Scrum events take place, removing obstacles, coaching the team in best Scrum and Agile principles and practices especially around self-management, cross-functionality and collaboration skills.
The Scrum Guide does give detailed information and a small extract: "The Scrum Master is accountable for establishing Scrum as defined in the Scrum Guide. They do this by helping everyone understand Scrum theory and practice, both within the Scrum Team and the organization" and highlight the three accountable areas as the Scrum Team, Product Owner and Organization.
The one area worth highlighting is the accountability around the organization. The Scrum Master should advocate for and explain the Scrum principles to stakeholders, and build an Agile Culture in the organization, by advocating for proper Agile Scrum adoption. Explain self-management and team autonomy to the stakeholders and the organization. Facilitate the transition from traditional methods to a Agile Scrum mindset. An example to illustrate; explain to the organization the negatives of using story points to drive KPI's.
The theoretical answer is that the Scrum Guide defines an area of accountability with some responsibilities attached. There is the assumption that some person in the organization will take on those accountabilities for a team and for the organization as a whole. @Pierre gave a very good answer on this theoretical side. I will add that every organization and team will have different challenges so it is very difficult to say exactly what a Scrum Master will encounter. It will be different every place and often it will vary from day to day.
The practical answer is that a Scrum Master does whatever the job description that the organization they work for says that they do. Many companies will use the Scrum Master title for a job because they want to give the impression that they are using Scrum and being agile. However, the job descriptions can read very much like a project manager at times. I have seen very few Scrum Master job descriptions that are as simple as the Scrum Guide's description of the accountability. There are always "other duties" added on.
What does a scrum master really do?
A Scrum Master manages people's understanding of Scrum.
Thank you @Danial. Not to overstate, but I wanted to say what @Ian said very eloquently in one sentence.
One of the key aspects of being a SM in my opinion is to promote Scrum in the organization, even educating stakeholders and leaders in the organization.
So often an organization does Scrum in name only, doing traditional management with a scrum facade. If the organization wants to do that, then it is their choice. Still I wanted to stress that the SM should promote proper Scrum, even if that is difficult and encountering resistance.