How long is a good science talk? I do, actually, have a number in my head. Actually, several numbers. Different numbers for scientists at different career stages. I'll reveal my numbers at the end of this post. First, some advice.
A good science talk is almost never longer than the time allotted for the talk. And, by almost never, I really do mean very close to never. In fact, going over time can magically turn a good talk into a bad talk. Back when I was a student at Cornell, I invited a scientist to speak at our natural history club about his work on whale communication. A day before the talk, the speaker asked me how much time we had allotted for the talk. This was the first person I had ever invited to give a talk and I made the fatal mistake of saying "As much time as you need", by which I meant, you know, "40-60 minutes." Well, after 2.5 hours I finally had to interrupt this prestigious scientist to call it quits. Of course, everybody hated this talk. The talk contained an enormous amount of fascinating information. My colleagues didn't hate the information, or even the presentation, they hated being held prisoner in that room for hours. Technically, the speaker didn't go over time, but he did speak for longer than everyone expected. This souring effect kicks into action remarkably quickly once you pass the expected quitting time. Going over by five minutes can leave a bad taste. Try to finish early.
Good talks tend to focus attention on only one or two major points. Perhaps one point for a short talk, maybe two points for a longer talk. Three points max! Your goal should be to communicate the arguments and evidence in support of these major points as clearly and concisely as possible. Everything in your talk should be in the service of these major points. Tangential work, peripheral points, and completely unrelated issues will only tend to confuse the audience. By limiting the number of topics, you should be able to keep your talk on schedule.
As a general guide I would say aim to speak for about two thirds of your allotted time. If you succeed, your audience will be fully engaged and people will have lots of questions. The Q&A will likely eat up the remaining allotted time. By the way, the best evidence that you have given an unsuccessful (or even a boring) talk is that your audience has very few questions. Perhaps counter-intuitively, abundant questions are the best sign of a successful talk. Your audience was fully engaged and that is why they have questions. They don't have questions because they are thoroughly confused; they have questions either because they are a little confused or because they have thought of extensions to your work. Unfortunately, most people will not tell you if you have given a boring talk, or even a moderately unsuccessful talk. This is a shame because I have discovered that the vast majority of people want to give good talks, but they have not received honest feedback. So, in the absence of direct feedback, you can use the number and quality of questions as a rough gauge of the quality of your talk.
Now for some numbers. I would say most junior folks (undergrad, grad student, early post doc) should be able to present a coherent, compelling talk on their work in 15 minutes. To put that in perspective, I will tell you a little secret. The talks at the HHMI Investigator meetings are fifteen minutes long with five minutes for Q&A. These are talks by some of the best scientists in the world, and they get only 15 minutes every two years to tell a compelling story to their colleagues. So, I don't think it is harsh to limit junior scientists to the same time span. As scientists become more senior, their science becomes more mature and it is appropriate in a regular seminar to listen to them for a bit longer. I think 40 minutes is probably optimal, with 20 minutes for Q&A. Longer than that can still work, but you better have explained everything very clearly and still have important compelling things to say toward the end.
Unfortunately, we have all suffered through talks that eat up every minute of the allotted time, or even talks that extend beyond time. Sometimes this reflects poor organization by the speaker and sometimes it reflects excessive exuberance by the speaker to tell you everything they have ever done (the "take no prisoners" talk). In either case, they have missed the point of giving a talk. Tell a story well and well within your allotted time. The old saying is true: "Nobody complains if a talk finishes early."