One of the handiest web browser tools
Investigate other websites source code
Viewing source code across browsers
The source code view is slightly different in different browsers. Some use different colours to mark different code attributes. You may also find that the source code can be incredibly badly structured when viewing the source code. This is usually a product of the code being generated dynamically on the server using PHP and you can copy the code into something like notepad++ to format it properly and get a better and easier view of it.
Learn from other website code
If you are building a website from scratch yourself and you want to give yourself a major advantage over your competitors. Gather a list of all their websites and carefully analyse their code. Gather as much information from reading through their code as possible. Looks for better ways of building your site and as said before carefully analyse the SEO throughout their pages and improve on it within your own.