When. At any time, and specifically in the sitting of the prayer before the closing salam, where this exact wording belongs. It is also customary on Fridays and whenever the Prophet's name is mentioned.
The words. Salli 'ala is not simply "bless". Salat from Allah upon a person is understood as praise and mention of him among the highest company; salat from a servant is a request for that. So the sentence asks Allah to do something He is already doing, which is why it is a supplication that costs nothing and asks for nothing for oneself.
Kama sallayta 'ala Ibrahim — the comparison is the striking part. A request is anchored to something already granted: as You did for Ibrahim. The supplication uses an answered request as the measure for a new one.
Al means family and household, and in both halves the household is named beside the man. Neither Ibrahim nor Muhammad is asked for alone.
Why it is associated with relief. Salawat is widely turned to in distress, and what can be said plainly is that it is a supplication which asks for nothing for the person saying it. A worry-filled mind is entirely occupied with itself; this occupies it with someone else.
Its shape. The wording is fixed and symmetrical — two halves, each naming a prophet and his household, closing on two names of Allah, Hamidun Majid. It is the form recited in prayer, and knowing it in full means the prayer's closing sitting is complete.