It’s 70 years after the death of the author. So if Andy Weir died tomorrow, The Martian wouldn’t enter the public domain until 2093.
That rule does not apply globally. Depends on where you live.
As a result most countries (but, yes, not all countries) have the Bern convention “life plus 70”