Why: I think it's mostly a matter of trump wanting to make a name for himself outside of his maga cult. Neocons never liked him, and he hopes this might change it. Plus, a dose of realpolitik in an effort to seem tough usually works.
When: It will have to end soon, otherwise he'll be shitting in his base. However, while wanting to pull back he'll realize he has two choices:
- Declare "victory" and leave the regime still in power, leaving people (his base included) asking what all these tax dollars were spent on
- Keep going, losing more and more support from his isolationist base and then some. Iran is, at present, the most unpopular war from a US polling perspective, so it is highly unlikely there will be a rally-around-the-flag effect for him. Even more unlikely the linger it goes on - a war doesn't become more popular over time.
How: Airstrikes will continue until the paragraph above has been addressed. And since Trump never reads history, he's probably way too optimistic, never realizing this simple fact: No country/regime has ever unconditionally surrendered because of conventional airstrikes and bombardment alone.
To quote Sarah Paine (renowned military scholar and historian), once you put your enemy on death ground, meaning they will have to fight on or (probably) die, they will not surrender. Trump never offered the Iran regime an offramp, and while it sucks to be in Iran right now, they have no incentive to surrender.