Halliday & Matthiessen (2014: 137-8):
In moving into the role of speaker, the listener has considerable discretion. Not only can he give any one of a wide range of different responses to a question, or carry out a command in different ways; he may refuse to answer the question altogether, or to provide the goods–&–services demanded. The speaker on his part has a way of forestalling this: he can add a (mood) tag, which is a reminder of what is expected, e.g. will you?, isn’t he?…
This is the function of the tag at the end of the clause. It serves to signal explicitly that a response is required, and what sort of response it is expected to be.