Madam is used in direct address, without the woman's name, especially to address whose name is not known: May I help you, madam? The male equivalent is sir。
The word lady is a polite term for a woman, specifically the female equivalent to, or spouse of, a lord or gentleman, and in many contexts a term for any adult woman. Once relating specifically to women of high social class or status, over the last 300 years it has spread to embrace all adult women。