Nomenclature rules are complex. We will only attemp to give names to relatively simple molecules. Look at the following examples of representative molecules bearing amide groups.
An ester comes from the formal condensation of a carboxylic acid and an amine (acid + amiNe = amiDe + water).
The amide function is almost always the principal one.
The main chain is ended by the sufix "amiDe" or "carboxamiDe". The numbering starts by the amide function.
Substituents at nitrogen are named using the localizer "N,(N)" as we do in amines.
When the amide isn't the dominant function, it is named as N,(N)- (di)alkyloxycarbamoyl.