I found answer in this [question][1].


  [1]: https://magento.stackexchange.com/questions/99150/add-block-to-layout-dynamically-in-event-observer

It can be done by using addHandle method:

    if (//if condition) {
        $layout = $observer->getLayout();
        $layout->getUpdate()->addHandle('custom_layout_handle_header');
    }elseif(//if condition){
        $layout = $observer->getLayout();
        $layout->getUpdate()->addHandle('custom_layout_handle_right'); 
     }

layout file

    <layout>
      <custom_layout_handle_header>
         <reference name="header">
           <block type="core/template" name="header_block" template="template.phtml" />
         </reference>
      </custom_layout_handle_header>
    </layout>

    <layout>
      <custom_layout_handle_right>
         <reference name="right">
           <block type="core/template" name="right_block" template="template_file.phtml" />
         </reference>
      </custom_layout_handle_right>
    </layout>