If You Didn't Get Funded
Above All, Don't Get Discouraged
You are not alone. Even great researchers ) have grant applications rejected. At CIHR, about 50% of applicants are ultimately funded by their third submission of a grant. If you are still not funded after that third submission, then your proposal is likely to have substantial flaws, or is relatively uninteresting compared to the competing grants. After the first rejection, don't wait: seek the advice of an experienced congenial mentor.
High-Risk, High-Benefit Research
If your grant was well written and the science is beautiful, and you still weren't funded, it is possible that you are ahead of the wave, and that the panel either didn't "get it" or, more commonly, that the risk-benefit ratio of the proposed work is unfavourable in their view, particularly when compared to other excellent, less risky but high-benefit applications. If the latter is the case, try to persuade your department Chair to give you some start-up funding to proceed, and also consider applying to the Institute of Genetics Request for Applications entitled "New Discoveries : High-Risk High-Benefit Grants".
[Note to Patricia and Étienne: This program does not appear to be offered any more. The link in the document is broken, and a search on the CIHR site doesn't turn anything up more recent than 2005]
Listening to Your Reviewers
Try to listen to what the reviewers are saying. Specific negative comments in individual reviews can appear, misleadingly, to carry more weight than the whole panel gave to that particular point. On the other hand, don't use the praise in reports from external reviewers to mentally dismiss the concerns of the whole panel, as articulated in the Scientific Officer's report.
Develop a Good Reputation with a Peer Review Panel
In general, stick with the same panel, at least on the first resubmission, even if you worry that they got it wrong the first time you submitted. Be sure it was the panel that got it wrong, and not simply that you didn't like the feedback. Call the grants manager or scientific director of the organization, to confirm your impressions of the reviews, and to be sure the grants panel was the right one. For CIHR, the person to call is the Deputy Director for the grants panel to which you applied.
Response to Reviewers' Pages
Be unfailingly courteous and appropriately brief. NEVER imply that the reviewer was incompetent, even if s/he was. Just address the most important criticisms factually and professionally. That approach always impresses a panel and helps you to win them over.
Becoming a grants panelist
As soon as you can afford the time, and once you are funded, it is useful to be on a grants panel, even an internal one. It will make you feel less paranoid about the process, and make you realize that reviewers are invariably doing their best to be fair and wise. Gaining grant panel experience will also help reinforce good practices, and correct bad ones, in your own grant writing.