How to contribute to open source
Contributing to existing project:
Since you are interested in contributing, not all open source products will accept you. Each product has some coding and committing rules and you may need to adhere to that.
Domain of your interest: First pick the project which suits your interest or preferred programming language and technology. Pick the project based on the domain not only by language. Just by knowing Java you may not be able to work on gaming project. You should have that interest.
Understand the project: Check out the project web site, you may find the link How to Contribute, Guidelines etc. Understand their guidelines, coding standards and patch acceptance criteria. Join their development and user mailing list. Download the source and try to learn how they have implemented.
Committers: Every project will have one or more committers. They are responsible to commit the code. Your code should be committed via them. Few projects may ask the volunteers to mail the modified code to the committers and few projects may request to send the patch to the development mailing list. But ultimately your code will be committed to the main branch via the committer.
Testing and Documentation: Coding is not the only way to contribute. You could do beta testing and file bugs. You could help for better documentation. Localize the messages and help manuals to other languages.
Contributing to new project:
Pick a group of like minded people and start a new project with your idea. Choose your license and terms and conditions. Many have succeeded by building open source products.
Re-invent the wheel: If you don't find any unique idea then re-invent the wheel. Try to do what others have done but with added unique feature. There should be some kind of uniqueness or difference which should make people to use your software. Many people will advise not to re-invent the wheel but if it so then there should have been only one product in each category. It is not the case, by re-inventing the wheel you could learn a lot.
Stale projects: Identify some stale or inactive projects from code hosting sites like Sourceforge or GitHub. Last activity of the project might have been some one or two years back. Pick the one, fix the issues and give new life to the project.
Porting: Most people would be interested to do porting. If you are Java programmer and you see some interesting stuff in Python or Ruby, just port it to Java. Port the code from one technology to other. One programmer cannot master over all available languages, porting the good projects will really help and many will appreciate the effort.
Many have interest, just the interest but very are few are actually implementing things. You just start, people will follow you.