What is the exact way to get Devil Deal Rooms?
According to the Rebirth wikia, there is only a 1% base chance for the Devil Room door to open. This chance can be increased in various ways:
This means that if you get damaged (this regards ONLY red hearts) during the boss fight you only decrease the chance to open a Devil Room, but there's still a small chance to find it anyway.
With pinckermans answer you know what factors influence your chances. But there is a handy overlay for Rebirth, which displays your current chance for a devil or angel deal (+ your other relevant stats).
It updates live, right when you pick up items, take damage etc. It's not really a mod, so it won't disable any achivements.
Link to the GitHub overview page
Link to the released versions