We’ve been exploring many ways of enabling customers to play music while the screen is off. Most of the solutions we had explored involved preventing Windows from being able to turn the screen off, which would result in a much higher degree of battery use—something that we don't want to do.
The good news is that a fix for this is in the Windows 10 Fall Creators Update. With this update playback on Spotify can continue while the screen is off to conserve your battery power. While you might not have this update yet, you can update Windows manually by going here. The music will, however, stop when your computer goes to sleep. You can control the sleep settings in the Power & sleep settings.