What is the ruling on istibra' and how is it performed?
Istibra' (cleansing from urine) is recommended. It is for a person to ensure that nothing remains of urine in its passage before performing istinja'. Its method is: to clear the throat (or cough slightly), shake the penis (meaning to pass fingers along it to expel any remaining urine if needed), and walk a few steps to the extent that one thinks nothing of urine remains if walking is needed. Each person knows his own nature best. The preferred opinion is that this differs among people. The objective is for one to think that nothing remains in the urinary passage that he fears will exit later. And Allah the Almighty knows best.
Is it permissible for a woman who has become pure before the end of forty days of confinement to perform different acts of worship? and is it lawful for her husband to have sex with her?
Once postpartum bleeding ceases and she is certain that it won`t happen again, she becomes pure, and so she should perform Ghusl (ritual bath), pray, and fast. She can also have sex with her husband even before the end of (40) days because the minimum of postpartum bleeding is a moment, and the maximum is (60) days. However, the postpartum bleeding for the majority of women is (40) days, but this does not apply to rest of them.
Is it permissible to repeat the Istikhara (seeking guidance) prayer, and is it a condition that one should sleep after offering it?
All perfect praise be to Allah,The Lord of The Worlds Istikhara is offered once, but it is permissible to repeat it, and sleeping after offering it is not a condition for its validity. And Allah Knows Best.
Is it permissible for one to masturbate in order not to commit fornication?
This is called committing the milder of the two evils such as eating a carcass in fear of death, and this happens when committing fornication is very likely to occur.