BW, my father was a full-time magazine writer/photographer for 50+ years. I started shooting photos for his articles and books when I was 13 (Rolleiflex TLR). I've spent my life writing and doing photography, writing and illustrating books, and editing a number of magazines. There's a lot to cover, but maybe a few thoughts.
If the publication reaches out to you, they have established a need or desire. This means they think there is value in your work. We creative types tend to 1. Underestimate the value of our work, and 2. be reluctant to negotiate the price upward, fearing a rejection of the deal, thus of our work, and thus of us. Hey, we're basically insecure.
If the outlet contacts you, there should be no question that you will be paid. REMEMBER: The first party to name a price loses.

"What's your usual rate for this?" is a good way for you to start. Whatever they say (assuming they name a price), you can work from that. "Oh, I don't think I can go for that price." And then don't say anything. Let the other party fill the dead air. Early on, ask what rights they are asking for. Get this spelled out clearly. One-time publication rights, and only online use of the work in the online version of the publication, with no other uses granted. No compilations, no advertisements, etc. Each use carries a value, and a price.
I learned this in a surprising way when I was so busy with free-lance work that I named a crazy (high) price when approached by (as it turns out) a camera company for work. Their response was a quick "When can you have that to us?" Hmmm . . . I realized that what I thought was an obscenely high price was actually a bargain to them. I recalibrated my fees and started making a lot more money.
No one volunteers to pay you more than you ask for.
You also need to know the market. If you are submitting to a publication, you should know in advance how much they pay for various uses. There are many ways to get this information, including just asking. Advertising pays much better than editorial, generally speaking.
The main thing, I think, is to call it a business, and not a hobby. Conduct yourself as a business -- professionally. Expect good payment for good work, and never take less. If you want to donate photos to a charity for their use, that's fine. Send them an invoice for the full amount you would normally charge (thus establishing the VALUE of your work), and then mark the invoice "No Charge" for the charity.
Others here have, I'm sure, more experience with this than I do. I'm the new kid on the block at NG, and I came here to learn.
But, I did buy my first Nikon (FTn) in 1971, along with a 24mm, 55 Micro Nikkor, and 135mm f/3.5. That was the kit I took to photojournalism school.
By the way, I recently went through this again with a Washington, DC, newspaper which wanted me to write for it. We bounced around on price and rights. We settled for less money than I wanted but also fewer rights than they wanted. It worked out.
