The Laws of Cricket state (Law 5.4):
In a match of more than one day’s duration, the captain of the fielding side may demand a new ball when the number of overs, excluding any part overs, bowled with the old one is equal to or greater than the prescribed number of overs. The Governing Body responsible for the match concerned shall decide the number of overs applicable in that match. This number shall not be less than 75 overs.
The Governing Body for Test matches, the ICC, have set this number at 80 overs. Therefore, in Tests, although there is no obligation to do so, the fielding captain may request a new ball after 80 overs.
Furthermore, according to Law 5.3, either captain may request a new ball at the beginning of an innings; this is the normal course of events.