Here's the mental model. Imagine you're placing characters one at a time into a result string. At each step, you want to place the character that has the highest remaining count, but you can't place the same character you just placed.
A max heap gives you the most frequent character at any moment. You pop the top character, place it, then push back the character you set aside from the previous step (if it still has count left). This alternation ensures no identical characters sit next to each other.
If the heap runs empty while you still have a leftover character that can't be placed, the rearrangement is impossible. This happens when any single character's frequency exceeds half the string length (rounded up).