As a verb, to affect means ‘to act upon or have an influence on’, as in “Sunless days affect my mood.” It can also mean ‘to make a show of; to put on a pretense of; to feign; to assume’ as “to affect ignorance.”To effect means ‘to bring about or create’ as in “to effect a change.” If you affect something, you do to it. If you effect something, you cause it to be.
Advertising might affect the sales of widgets (by causing them to increase), or it can effect sales (bring them about) if, for example, there were no sales at all to begin with.
As a noun, effect means ‘result, consequence, outcome’. An effect is that which is produced when you affect something: “The poem affected me deeply; it really had an effect on me.” Affect as a noun is a term from the field of psychotherapy meaning ‘the emotional complex associated with an idea or mental state’. Keep in mind that usually if you want a noun, the word you want is effect, but if you want a verb, the word you want is affect.