The retained earnings are calculated by adding net income to (or subtracting net losses from) the previous term's retained earnings and then subtracting any net dividend(s) paid to the shareholders. The figure is calculated at the end of each accounting period (quarterly/annually.)