Another good way of solving problems like this is to set up a correspondence with a problem you already know how to solve. In this case, imagine that you've got a sorted set of six non-consecutive numbers $a_1, a_2, \dots a_6$ between 1 and 49. What does it look like? Well, the first number $a_1$ is essentially arbitrary; it can't be greater than a certain value (i.e. 39) or else there isn't 'room' for five more non-consecutive numbers above it, but we can ignore that for now. The second number $a_2$ has to be greater than $a_1+1$ — that's what it means to be nonconsecutive, after all — so we know that $a_2-1$ (call this $b_2$) is greater than $a_1$. Similarly, $a_3$ has to be greater than $a_2+1$, so $a_3-1$ is greater than $a_2$, and $a_3-2$ is greater than $a_2-1 = b_2$; we can call this $b_3$. And so on, and so forth, until we define $b_6 = a_6-5$. But this correspondence works both ways — given the $b_n$ it's easy to get the $a_n$ — and so we have a one-to-one correspondence between our non-consecutive sets of numbers and an ordinary combination (but with a different upper bound - can you see what it should be?). It takes a while to build this sort of instinct, but learning how to spot these correspondences is the most basic tool for proving most combinatorial identities.
There are at least two different ways to extend this problem to larger $n$. Here's an approach which works for the easier of the two ways, which is where the vertices of $K_n$ are $n$ points in general position forming a convex $n$-gon, so every internal node is on exactly two edges.
Every triangle can be associated with a triple of distinct edges of $K_n$ (the edges you get if you extend the sides of the triangle as far as possible), and each triple of edges is associated with at most one triangle. So we just need to count the "good" triples which do give a triangle, i.e. every pair of edges meets (either at a vertex of the original graph or at an internal node).
Suppose we know the set of endpoints of a good triple of edges (without multiplicity): how many good triples have exactly those endpoints? If there are six points in the set, $a,b,c,d,e,f$ in cyclic order, there is only one good triple consisting of the edges $ad,be,cf$. If we have five endpoints, $a,b,c,d,e$ in cyclic order, there is exactly one point in two of the edges. Suppose it is $a$. Then the only possibility is $ac,ad,be$ (thanks to Henning Makholm for pointing out that my other "possibilities" weren't valid). Since the choice of $a$ was arbitrary, there are $5$ possibilities in total. If there are four points $a,b,c,d$ in the set, the only possibilities are $ab,bd,ac$ and cyclic rearrangements. Finally, if there are only three points there is only one possibility.
This means the number of triangles is $\binom n6+5\binom n5+4\binom n4+\binom n3$.
To deal with the other plausible extension (the vertices form a regular $n$-gon) you'd need to calculate the number of degenerate triangles arising from three diagonals which all meet at a point, and subtract them off.
Best Answer
To have a rectangle, you need 2 horizontal lines and 2 vertical lines. So for your given picture, there are $5\choose 2$ choices for two vertical lines. Also $4\choose 2$ choices for horizontal lines. So there are ${5 \choose 2}\times{4\choose2}$ rectangles in total.
The strategy is to find a way to categorize the things you want to count. Various problems will require various tricks, but you can gain experience by trying to solve them by your own.