About 5 seconds before Apple Music moves to the next song, an Up Next line appears under the closed notch with the song title and artist, along with a countdown animation.

Turn it on or off
Settings › Media › Player appearance › Up Next countdown (on by default).
When this line appears
- Only with Apple Music.
- When repeat one isn't on.
- When you haven't scrubbed in the current song. Once you scrub, that song won't show it.
The timing matches the song transition you set in Music › Settings › Playback › Song Transitions (AutoMix, Crossfade or no transition).