Q:

How do I apply JHtmlSidebar to add a sidebar to my admin view?

I can't find any tutorials on how to use the JHtmlSidebar Utility Class.
This comes close to it: Creating a toolbar for your component, but it is very vague. It mentions $this->sidebar, which suggest that the View class should have an attribute sidebar. But sidebar attribute doesn't exist in the View class.
I tried using this:
JHtmlSidebar::addEntry('test','test',0);
echo $this->sidebar = JHtmlSidebar::render();

It does indeed echo the sidebar, but it sits at top or bottom of my view, not on the side. I'm just wondering if there is a way to let Joomla do the rendering for me, instead of creating my own layout.
Some help or links to useful tutorial on the use of admin side bar would be much appreciated. Thank you.
com_helloworld/views/helloworld/view.html.php:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

class HelloWorldViewHelloWorld extends JViewLegacy {
    public function display($tpl = NULL){
        $this->addToolbar();
        $this->sidebar = JHtmlSidebar::render();
        }
    }

    protected function addToolbar(){
        require_once JPATH_COMPONENT . '/helpers/helloworld .php';
        JToolBarHelper::title( 'Hello World', 'helloworld' );
        JToolBarHelper::addNew();
        JToolBarHelper::deleteList();
        JToolBarHelper::editList();
        JToolBarHelper::preferences('com_helloworld', '500');
        xProfileHelper::addSubmenu('helloworld');
    }
}

com_helloworld/helpers/helloworld.php:

class HelloWorldHelper extends JHelperContent
{
    public static function addSubmenu($vName)
    {
        JHtmlSidebar::addEntry(
            'test',
            'index.php?option=com_helloworld&view=helloworld',
            $vName == 'profile'
        );
    }
}

A:

You firstly need to create a helper file, for example:
administrator/components/com_helloworld/helpers/helloworld.php

and in this file, add the following:
class HelloWorldHelper extends JHelperContent
{
    public static function addSubmenu($vName)
    {
        JHtmlSidebar::addEntry(
            'test',
            'index.php?option=com_hellowworld&view=VIEWNAME',
            $vName == 'banners'
        );
    }
}

Change VIEWNAME and the value for $vName to the view for your component that you wish to add the sidebar to. 
Then, in your view.html.php file, call it using the following:
HelloWorldHelper::addSubmenu('VIEWNAME');

and of course, the following is required to render the sidebar which you can put below the code above:
$this->sidebar = JHtmlSidebar::render();

If you have a look at the Banners component that comes packaged with Joomla, it will provide a good example.
Update:
If forgot to mention, inside your addToolbar() function in the view.html.php file, you will need to call the helper file like so:
require_once JPATH_COMPONENT . '/helpers/hellowworld.php';

Update 2:
Sorry, I'm not on the ball today. You will need to add the following to your default.php in views/VIEWNAME/tmpl:
<div id="j-sidebar-container" class="span2">
    <?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
     // Main part of the component view
</div>

