Of the three pillars of medicine, research is the most ellusive. Unless you are in an MD/PhD program---not an option for most Europeans---you will have other priorities in medical school. And unless your residency program has a built-in research year, the way most surgical residencies do, you will either be way too busy in a university or a large community program to do any research, or have plenty of free time in a lower volume community hospital that doesn't have many research opportunities.
When I interviewed residents-to-be last year, my first thought on seeing a non-PhD applicant having 18 publications on his or her CV wasn't "Wow, she is a research machine, we gotta have her", but rather doubt that anyone could be that productive during medical school. More points subtracted for thinking the interviewers would be so gullible.
I graduated six years ago, far enough not to be able to give advice on how to do research as a medical student. The hows and whys are institution-specific, so anything I wrote would have to be in Serbian anyway. Residencies, though, are similar enough to each other that I do have some words of advice for new residents wanting to do Research! in a community hospital, university-affiliated or not.
Patient care trumps research. Unless you have already worked as an attending in another country before coming to the US for residency, don't waltz in to your PDs office on day one asking about research opportunities. Prove yourself on the field first, then six months later, when you're comfortable managing DVT prophylaxis, septic shock, and what not, start asking questions.
Get your own idea? Common wisdom says it is better to come up with your own question and start your own projects, since you will be more invested in the outcome. Well, yes, sort of. Unless it is a quick-and-dirty chart review you can do over a two-week vacation---and even then there are IRB hoops you'd need to jump through to get anything done---you will get your inexperienced self into the murky world of project management. Many brilliant ideas have died on the field of required signatures, ambiguous data points, and impossible-to-coordinate meetings. Which is why this next advice is important.
Find good mentors. Surrounding yourself with a few good people is orders of magnitude better than having many good ideas. Research topics come and go, as does our interest in different fields of medicine (yesterday's apoptosis is today's epigenetics is tomorrow's something or other). It is unlikely that the research your started in residency will continue onward into fellowship, but the knowledge, skills, and general wisdom you pick up from your mentors should serve you well into your career. NB: don't wait for someone to be "assigned" to you---although that's what many residency programs will do. Seek out people who match your character and who would be able to give you advice in at least three fields: patient care, research methodology, and research topics. This can be one person, or five. And if you find an awesome mentor who just isn't doing any research right then, you can always write a review.
Is it Science! or quality improvement? ACGME is big on Quality! and Patient Safety! this year. Programs take notice. If you can present your interest as a quality improvement project rather than small-s-science, consider doing it. Not only does showing interest in quality improvement look good on a CV, your institution might have special funds for resident QI projects. A dedicated QI mentor is also a good resource, if you want a carreer as a Sith lor---erm, hospital administrator.
Interest in research goes from I just want something on my CV so I could get a fellowship to When I grow up, I'll have my own lab, but this applies to most people in most circumstances.