Short form of they had, used mainly before a past participle for an earlier past action, and in they'd better to give advice.
They'd already left.
Here they'd means they had. In they'd better, it means they had better.
Common phrases & grammar
they'd already finished · they'd better leave