There are many ways, and there isn’t any single “right” way.
The norm used to be percentage of ad spend (usually in the 10-20% range) but the industry seems to be drifting away from this. Other folks charge on a performance/commission basis. Others charge hourly.
At Discosloth we charge a flat monthly retainer fee. We’ve found that clients both large and small prefer this method as they know what to expect, and it’s decreased client churn for us as well as being more profitable with smaller to midsize accounts.