Typically, a blessing is recited before fulfilling a commandment. For example, before putting on tefillin, lighting the Hanukkah candles, reading the Scroll of Esther, etc.
In rare cases, a blessing is recited after fulfilling a commandment, for example, after washing one's hands before eating.
This is apparently because our hands are not always clean before washing them…
Therefore, some Talmudists (for example, Rabbi Ai Gaon) believe that if one knows their hands are clean, then one should recite the blessing before washing their hands.
These blessings have the same beginning: "Baruch Ata Adonai Eloheinu Melech Haolam Asher Kidshanu BeMitzvotav VeTzivanu…" (translation: Blessed are You, our God, Master of the universe, who has sanctified us with His commandments and commanded us…).
The text of the end of the blessings corresponds to the commandment being fulfilled. For example, when lighting the Hanukkah candles, the blessing ends like this: "…VeTzivanu Leadlik Ner shel Hanukkah" (translated as "…And He who commanded us to light the Hanukkah candles").
