For sharepoint 2010 and windows server how can i handle the license
problem. How long are their trials? Should i use them as trial and
re-install afer trial period and so on?
You'll need to be covered by an MSDN license (which should be the case if you're working for a company and which is heavily recommended if you are a freelance). That will give you activation keys for all required Microsoft products (don't forget that you'll also need activation for SQL Server 2008 / 2012, Visual Studio 2010/2012.
(nb : A technet subscription is not enough as you are not supposed to do development under that license).
Alternatively, you can go the trial road and download all softwares as trial and repeat the process after 90 days / a few months but that's a lot of trouble.
A third solution is to rely on the 2010 Information Worker Demonstration and Evaluation Virtual Machine which contains a three Windows Server 2008 R2 SP1 Hyper-V Virtual Machine set for evaluating and demonstrating Office 2010, SharePoint 2010 and Project Server 2010. You'll need to start from Windows 8 or from Windows Server 2008(R2) for the Hypervisor (or convert it to a Virtual Box / VMWare instance)
Which one is better: using vmware or installing windows server 2008 on
other partition?
I'm a big fan of Virtual Box. It allowed me to create a full security trimmed farm with a dedicated AD / SQL Server / Apps Server and 2 WFEs (manually load balanced ;)) on my host machine which is perfect to test real world deployments but if you have a not so powerful machine or only 4GB of ram, I would heavily suggest to implement a boot to VHD solution. You create a virtual disk within your Windows 7, mark it as bootable and then do the Windows Server 2008R2 on it. You'll reboot on your VHD and thus use the full power of your machine (and you can easily backup the single vhd file just like suggested for Virtual Box.
What about non-domain environment for sharepoint?
If you're doing client object development, client side or middle tier development, that's ok. If you're doing serious business with SharePoint, forget it. You'll never, ever deploy in an environment with no security constraint and with that configuration.
Hope it helps.