The ScrumMaster ideally should be a person not involved in the work, so not one of the team members. In practice this recommendation is often not followed, impacting effectiveness especially in times of crisis.
The ScrumMaster should also not be the Product owner at the same time as this is even more dangerous. This is because the short-term interests of the ScrumMaster are often the opposite of those of the Product owner.
He must have the authority to enforce the rules of the process.
He does not care about the actual content or quantity of the work. His primary interest is transparency, so he ensures that the team works together and provides a clear status, and that the Product owner provides clear requests and clear feedback.
He owns the process, maintains planning tools like spreadsheets or taskboards and is channeling improvement efforts.
He also is the central hub in following up on impediments that come up. He ensures the next steps are clear and are being executed. For organizational impediments he liaises with other parties in the company to facilitate a solution.
For the roles in the various meetings see the How-to for ScrumMasters.
Involvement in the Scrum of Scrums
The ScrumMasters of all teams participate in the weekly Scrum-of-Scrums meetings for ScrumMasters where they discuss and exchange problems they encounter and ideas they have related to the Scrum process and the ways the teams work.