how to sum all the returned rows
You need to use SUM() of TOTALFEE and GROUP BY the remaining column names.

The query will be:

SELECT ad.STUDENTMASTERID, ad.ADVERTISEMENTCODE, cod.POSTNAME, 
       ad.CANDIDATENAMEINNEPALI, ad.PAYMENTSTATUS, SUM(cd.TOTALFEE) AS TOTALFEE, cod.CLASSNAME
FROM CANDIDATEAPPEARAGAINSTADVTCODE ad
INNER JOIN CANDIDATEAPPEARTOADVTNUMBER cd ON ad.STUDENTMASTERID = cd.STUDENTMASTERID
INNER JOIN ADVERTISEMENTCODE cod ON cd.ADVERTISEMENTCODE = cod.ADVERTISEMENTCODE
WHERE ad.STUDENTMASTERID = '415562'
    AND ad.PAYMENTSTATUS = 'Pending'
    AND cod.STATUSOFLASTDATEFORMSUBMISSION = 'Live'
GROUP BY ad.STUDENTMASTERID, ad.ADVERTISEMENTCODE, cod.POSTNAME, 
       ad.CANDIDATENAMEINNEPALI, ad.PAYMENTSTATUS, cod.CLASSNAME;