The usage is the same as that of nearly all verbs in the past simple and present perfect. The past simple locates the situation clearly in the past: As soon as he staggered through the door, I realised he was drunk. The present perfect gives the situation some connection to the present: Peter seemed a little strange; I've realised since that he must have been drunk.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.