What Scrum Master should do if defined work is not done at the end of the Sprint?
First, ask if the Sprint Goal was met. Meeting the Sprint Goal is far more important than completing all of the work that was put into the Spring Backlog.
Then, the Scrum Master should facilitate the Sprint Review and Sprint Retrospective as necessary. The Sprint Review, among other things, gives a chance for the Product Owner to share with stakeholders the reality versus the initial forecast - what work was done and not done - and the Development Team to discuss things that went well and what problems arose during the Sprint. The Sprint Retrospective gives the Scrum Team a chance to inspect itself and its way of working to improve for the next Sprint. As a result of these two events, the Scrum Team should have a reordered Product Backlog that reflects the most valuable work to be done for stakeholders and a good idea of how to improve on their ability to deliver in the next Sprint, both of which provide feedback into Sprint Planning. The team can ensure that they craft an appropriate Sprint Goal and select an appropriate amount of Product Backlog Items based on what they've learned and what they are forecasting for the upcoming Sprint.
Thank you Thomas for the response.