The iPod was introduced in 2001 with the tagline "A thousand songs in your pocket." In modern English, the word song refers "by extension" to any musical composition, sung or not. However, judging by Western classical music, there used to be a lot more instrumental pieces, i.e. a lot of music wasn't songs.
Was there a shift when mainstream music became much more focused on singing? Or is classical music not a fair representation of history and Western music has always been song-focused? What about non-Western music?
Also, "a thousand songs" referred to the iPod's 5 GB capacity. An article from its era explains:
A good rule of thumb is that tunes recorded at so-called "CD quality" (128Kbps, aka the bit rate) will take about 1MB of space for each minute of music. A five minute song takes up about 5MB.
and then the article reviews several competing music players including the number of songs each could store, e.g.:
a 5GB player that holds 1,000 songs ($299), a 10GB version, which holds 2,000 ($399) and a 20GB version that holds up to 4,000 ($499)
How did songs get to be around five minutes long, or close enough to treat that as a reasonable average? Has the average length of songs changed over time?
As for your second question, the wonderful /u/hillsonghoods has written previously about song length, as did a deleted user. These answers both generally agree that conventions around song length were shaped largely by recording.
Of course, this doesn't quite answer your first question; I'll leave that for other commentators.