Ask questions and get answers from experienced industry professionals
Flashing is an essential component for any window installation. This is part of the system which protects from water intrusion and structural deterioration. There may be gaps between your framing or old frame and replacment window frame. These are typically filled with insulation (usually foam) for energy conservation and to prevent drafts.
Simplified / general answer above. As with most construction / improvement details, doing it right depends on products, conditions, and is more complex than a two or three line answer can fully describe. Your best assurance of having it done right is to engage a responsible and experienced contractor.