Honestly, it doesn't seem to matter much -- I've played in more tournaments than ever this year, have been running our weekly singles event on Monday nights and have been playing more casual rounds with my son and occasionally with other folks, and it's been pretty random when I shoot well and when I don't. Two weekends ago, I played a tournament where I didn't play particularly badly either round, but had a couple of holes that killed me each round. Last weekend, I had my best tournament round ever (by preliminary rating), along with a second round that was slightly worse -- this one was on my home course, and I've shot the same score in both casual rounds and in the weekly singles mini -- and I've also shot 7 or 8 strokes worse than that recently on the same course/layout.
I do think I tend to play better when I'm playing with folks who're not dramatically better than I am -- I don't mind playing with people who typically beat me by up to 9 or 10 strokes per round (not a difficult feat in my case), but when we're talking guys who could comfortably give me a stroke per hole, I think the consciousness of how much worse I am gets to me. That's one reason I rarely play doubles anymore, given the crowd we tend to draw, and why I've been really pleased with breaking our Monday night singles series into Open and Rec divisions.
Course distance also affects me a lot -- I will shoot significantly higher-rated rounds on shorter layouts against the same competition on the same day compared to a longer layout, and the same is true across different events. It's strictly a matter of not being able to throw past the end of my shadow. On a shorter layout (particularly one that punishes errant throws) I can consistently keep my drives and upshots where I want them, shape lines and calibrate distance to end up with makeable putts, and get myself out of trouble effectively when I do make a mistake. On a longer layout, I can generally do the same things, but instead of having a short makeable putt after two strokes on most holes, I'm often still 40' to 100' out and still looking at two strokes to close it out. I've noticed a definite inverse correlation between course length and round ratings for me, since shorter courses play to my strengths and mitigate the distance advantage most of the competition has on me.