Can you be friends after a breakup?

What factors are dependent on whether you remain friends?