As above, with things like how predictable future income is being particularly important. So a shop with one year trading history is worth less than one with ten years of constant growth but that is worth less than one with contracts that guarantee an income for the next three years.
Balance sheet assets (buildings, IP, meaningful r&d etc.) can all add to the value but of course liabilities (debt or risks) will detract from it.
It is not an exact science though and depends what people are prepared to pay for it. Two or more keen buyers will push the price up, esp if it compliments their existing offerings. It also depends a lot on sector – tech businesses are often worth way more than profit would suggest. And finally it can also depend on who is selling and why, e.g. If a single shareholder who wants to retire then an earn out over s few years can be easier than if there are many stakeholders, especially if some of those are key employees you need to retain.