I will interpret the problem in the simplest terms first, the classic problem assuming the pen is always crossing with a length of 10cm and not rotating.
A simple and elegant solution:
Consider a circle of diameter 15 cm. This circle will ALWAYS touch the bars at 2 distinct points.
Since the circle touches the bars at 2 points, and has a circumference of 15pi, we can say that a part of the circle with length x has a 2x/(15pi) chance of touching the line.
As the circle gets smaller, it is noticably less circle- like, indeed, approaching that of a line. This gets us thinking, and soon we realize that, independent of shape, any given point should have the same probability of touching the bars. Furthermore, we know that probability!
We can therefore say that, for any segment, of any shape, of length X, the expected number of times that the segment touches the bars is 2x/(15pi).
Since the pen can't touch the bars more than once, the expected number of times that the segment touches the bars is equal to the chance that the segment touches the bars!
Therefore, the solution is simply 2*10/(15*pi)= 20/(15*pi)
From here, it isn't so hard to consider the pen falling at any angle (Assuming no spin).
Since we've just proved this relationship to be linear, we realize that we can just take the average length of the pen as it spins. As it spins, the length of the pen is just sin(theta)*10. The sin function can be found to have an average of 1/sqrt(2) through calculus, so the answer to that question must be 20/(15*pi*sqrt(2))