Maximum number of right-angled triangles 
Let $S$ be a set of $n$ points in the plane, no $3$ collinear. Determine the maximum number of right-angled triangles with all three vertices as points in $S$. 

This is a slightly more difficult and precise question than IMO 1970. For $n=3$, clearly the maximum is one. For $n=4$, we can have four triangles, etc. However, I don't know how to continue.
 A: For 5 points the maximal number of right triangles is 7.

In the following figure, $\phi$ is the golden ratio.  Drop two and one of the extremal points to obtain 12 and 16 right triangles on 6 and 7 points. Partially based on the Kepler triangle.

For 8 points, 24 right triangles are possible with a regular octagon. Dropping a point yields only 15 triangles, so the above solution is better. 
 
The regular decagon gives 40 right triangles.
The regular dodecagon gives 60 right triangles.
A: The arguments below are mainly from observation without proofs. It may even not be the best case, but it follows logically from the case for $n=4$ by considering how to maximize the numbers of right triangles.
Start with the case for $n=4$ , clearly a square pattern gives us the most numbers of right triangle. Then, we want to maximize the number of right angled triangle formed by adding an extra point. Can we add 2? The answer is No. The only point that would give us more than $2$ extra triangles would be at the centre of the square, but that would violate the rule. You can try to find out the points which would give you an extra right angled triangle by drawing circle using any line segment between two points as the diameter. Any point lying on the circles would be a possible choice of the next point. Let's randomly choose one point $A$ from it, we will use it later. But for now, we know the maximum number of triangles formed by $5$ points would be $5$ since we can only add one triangle. 
For case $n=6$, we try to find another point that would add some more right angled triangles to the shape. Now I claim that there is a point that can give you at least $2$ extra right angled triangles. (I cannot prove the existence/ non existence of a point that gives 3 extra triangles.) As shown it the diagram below, $B$ is a point that lies on two circles. (Excuse my bad drawings, I didn't have a compass in hand)  
So that would make the number of right angled triangles $7$.
Now we would like to add two points at once. Recall that we could construct a square from $4$ points, which would give us $4$ extra triangles. We can add points $C,D$ so that $A,B,C,D$ form a square, thus giving us $4$ extra triangles: 
So for $n=8$, we can at least have a configuration that gives us $11$ right angled triangles. I cannot say for sure that $C,D$ must not lie on any circle (thus giving more right angled triangles) but it looks pretty unlikely.
So following this construction, for the nineth point, unlike the fifth point, can be chosen to be on two circles: (excuse my terrible drawing, I hope you can at least see what's going on roughly)

So $E$ would give us $2$ more triangles.
Im not going to draw this one but we can find the tenth point that could give us $2$ more triangles. And an eleventh and twelfth point that form a square with the previous two points. Up to $n=12$ , we can get to $15$.
So my deduction is that for $n=4k$, where $k>1$ is a positive integer. We could at least get $n+3$ points. I am expecting someone to find a better result than this.
A: OK, for record's sake here's a solution.
The answer is $\frac{n(n-2)}{2}$ for even $n$ and $\frac{(n-1)(n-2)}{2}$ for odd $n$. The construction is to draw a circle, and pair up your points to be diametrically opposite (so when $n$ is odd, we have one lonely point not in a pair).
To show that we can't do better, for each point $P$, we count the number of triangles for which $P$ is the right angle. The key insight is that if $X,Y$ form a right angle at $P$, then this is the only right triangle at $P$ involving $X$ or $Y$. Otherwise, if (say) $\angle YPZ=90^{\circ}$, then $X$, $P$, $Z$ are collinear, contradiction. So there are at most $\lfloor\frac{n-1}{2}\rfloor$ triangles that their right angle at $P$.
Applying this to all $n$ choices of $P$ implies the result for even $n$. Some more fiddling is required when $n$ is odd.
