First, you've got to have enough margin in the deal to make it work. The rule of thumb is 70%. That is, fix plus rehab should be under 70% of the price you will sell it for. That's typically quoted (even by me) and 70% of ARV, but in this case ARV really means what you can sell for. That rule of thumb assumes you're using hard money, you will hold for six months (close to close) and you'll sell with an agent.
If you're an agent, you'll collect some of the commission on both the purchase and the sale and that might affect your math. Really shouldn't, because you're earning that money with the agent work.
If you have your own cash, that might affect your math, too. Again, IMHO, it should not because you're really acting as your own lender, and you should keep your lender hat on when putting in the money.
Nevertheless, if you can play those two roles, fix and flips can be much more profitable.
The property has to have enough work to justify the new price. An appraiser is going to need to justify the new, higher price. That's pretty easy to do if you gutted it to the studs and redid everything. Much tougher with a new coat of paint and new carpets.
Be SURE about your new valuation. This is VERY hard. If you're in a neighborhood of cookie cutter houses and there are plenty of sales, you can find solid comps. If there is a lot of variation or there are few sales, it can be much harder to comp. Assume the appraiser on the sale will use the lowest comps they can find. That way you can be pleasantly surprised if the discard the dregs and pick higher ones.
Be aware of permitting issues. As soon as you start touching stuff, old problems become your problems. Find out what requires permits and what doesn't. If permits are needed, get them. If licensed contractors are required, verify licenses. Call the city or county and verify licenses.
You can see my recent an ongoing disaster here.