This varies widely from culture to culture and country to country. It would be unfeasible to address this for the whole world. And at any rate in some places surnames are still not inherited like what you may be thinking of.
Could you narrow don the question at all?