Can I install SQL server 2012 on a same machine with SQL server 2005? I have been using SQL Server 2005 standard for quite a while, and it is working great. Now I need to use SQL Server 2012. Will this effect my existing databases? How much risk is involved in installing SQL Server 2012 on a machine that has SQL Server 2005 running?
Yes, you can install an additional instance of SQL Server 2012 (you'll need a named instance if your 2005 instance is a default), and it can happily co-exist without interfering with your existing 2005 instance. None of your existing databases will be touched, and you will still be able to have both 2005 and 2012 versions of the client tools, too (this isn't true for all side-by-side installs of different versions).

You could also opt for an in-place upgrade; this will keep your named instance and upgrade your databases. Need to be careful with this one though; run at least the 2012 upgrade advisor in case you have 80 compatibility issues, queries with old join syntax, etc. This is not an exhaustive check (it can't check queries constructed by dynamic SQL, and it won't check queries submitted by applications either) but it's a good start.

To learn more about how SQL Server behaves with multiple version I would suggest you to read Work with Multiple Versions and Instances of SQL Server