I usually analyse the piece to find out why I think the composer has done such a good job. When I analyse I try to find out what the composer has been thinking, I especially lay weight on the harmonic analysis to find out why he has chosen the chords he uses, but also I focus on which form he<s writing in, an what he has done whit this form to make the piece special and memorable.
If I find something of interest, I get inspired and use some of it in my pieces, but of course with my own twist.