where and how to connect battery for RTC of DSPIC33EP512MU814
DSPIC33EP512MU814 do not have a separate RTC domain VDD and hence backing up only RTac registers is not possible when the main power supply is not available.

The RTC module keeps running during both IDLE mode and SLEEP mode but I think your concern is when there is no DC supply to the board itself. 

It depends on the duration for which it is expected to keep the time intact. 

If it is for a few seconds only then with a super cap and some diode logic, one can enter sleep mode/low power mode, cut power for other components by detecting removal of DC supply... with some tweaks..

If the requirement is in hours, it is better to choose to go for external RTC and a super capacitor (gold capacitor) sizing based on the external RTC module current when in battery mode. Random example below.