Does passing wind from the anus affect ritual purity?
Ablution is nullified by the passing of wind from the anus, but washing the anus is not required as wind leaves no impurity.
I made a vow "If the Israeli troops retreated out of Gaza strip I will buy a cake from a certain bakery" and it happened. Am I obliged to buy from the same bakery?
You are obliged to buy from the same bakery. And Allah Knows Best.
Is it permissible for a woman who broke fasting due to a delivery to pay a ransom?
She should make up for the missed fasting days once she becomes ritually pure, but it is impermissible for her to pay a ransom while being able to fast.
What is the expiation for perjury?
One who commits perjury should repent, seek Allah`s forgiveness and offer an expiation which is: feeding ten indigent persons, or clothing them, or giving a slave his freedom, but if that is beyond his means then, he should fast for three days. Allah, The Almighty, Says in this regard (What means): "Allah will not call you to account for what is futile in your oaths, but He will call you to account for your deliberate oaths: for expiation, feed ten indigent persons, on a scale of the average for the food of your families; or clothe them; or give a slave his freedom. If that is beyond your means, fast for three days. That is the expiation for the oaths ye have sworn. But keep to your oaths. Thus doth Allah make clear to you His signs, that ye may be grateful." [Al-Ma`idah/89].