So it is year 2024 and the max BTC supply is reached at ~21M.
Will it be economical to continue mining BTC going forward?
The max BTC supply will be reached not as soon. The more BTC there will be already - the more difficult it will be to mine them. Mining will be profitable, I think, because now miners gain more from transaction fees, than from receiving BTC. When there will be 21M of them there will be so much transactions daily, that miners will easily compensate energy expenses.