A great sense of writing is developed by listening to and reading great writing. It's the same for music. Some of the learning is by imitation, but also by absorbing the perspective of the great by osmosis. No one teaches a child it's native language, it's learned by the time the child goes to school and children with parents that speak well and creatively speak the same themselves. Study, absorb, bathe in the masters of the music you love.
One of the great rock groups of all time, Chicago, lays down one of the saddest songs of all time,Wishing you were here. By opening with the Major V chord at the beginning of the vocal "Sleepless hours and dreamless nights and" the listener is deceived into thinking there is a hopeful path available for the song, but the dm on "far aways" says NO and when the harmonies come in "Ooooo, wishing you were here", the deal is sealed – notice it's not angry, not bitter, just deeply melancholy and sad.
All music, classical, rock, written & improvised, is a balance of creating tension & resolving it – through many dimensions & facets.