Hi, friends,
Thank you all for your help.
I made a summary of what I understood. Would you be kind enough to have a look if there are any mistakes? Thanks a lot in advance.
A: I hope he has failed his exam.
B (agrees): I hope so, too. /Me too. /And me. /So do I. / Same here. /I hope the same. /Likewise.
B (disagrees): I hope he hasn’t! / I hope not. (‘I don’t hope so.’ is not suitable, people never say that.)
A: I hope he hasn’t failed his exam.
B (agrees): I hope so, too. /Me too. /And me. /So do I. / Same here. /I hope the same. /Likewise.
B (disagrees): I hope he has! (‘I hope not’ is not suitable here. It would be confusing.)
Conclusion:
Whether person A says ‘I hope he has failed his exam’ or ‘I hope he hasn't failed his exam.’ if person B agrees with person A, the replies are the same; if person B disagrees with person A, the replies to the two statements are totally different.