Your doctor will tell you how long before the IUI you should ejaculate.
I am confused by your post because your doctor should have answered all these questions!
You also should be seeing a reproductive endocrinologist instead of a gynecologist for the IUI.
You probably shouldn't move to IVF after only trying IUI once. IVF costs a lot more money and is a LOT more invasive for your wife.
There's a book called How to Make Love to a Plastic Cup, written by a man about his experience with infertility.