There are multiple reasons why a domain join might fail. Right place to look at is the log NETSETUPLOG in c:\windows\debug folder.
I’m going to brief about a specific issue which i managed to fix
I was trying to join Windows server 2012, 2012R2 & 2016 servers to domain and randomly it kept on failing. Few systems would join to domain and other wouldn’t. It fails with error “semaphore timeout has expired”
Troubleshooting it i ensured i was able to resolve name and reach the DC’s. No firewall or AV blocking any communication. I looked at the netsetuplog and found client was not able to connect to the DC IPC$.
I wondered how it worked in few instances and checked the Domain controllers part of the site; interestingly the DC’s i wasn’t able to reach were running 2003 OS (Dont be surprised, we still use 2003)
You would’ve now figured out that, to communicate with 2003 OS’es we need SMBv1.
2012 or 2016 doesn’t have SMBv1 enabled by default, you have to enable it in Server Manager features.
Once i had SMBv1 enabled, i was able to join all systems without any issues.
Hope it helps!!