One of the great things about writing songs for the theatre is that, if the playwright or bookwriter has done their job properly, a major part of the songwriter's job has already been done before they even set pen to paper. The songwriter will have a very clear idea of what the song needs to achieve, in terms of developing the story and the character(s), adding comic relief, taking the emotional level of the play up a gear, or combinations of the above and more.