5. Given $n$ points $A_{1}, A_{2}, \cdots, A_{n}(n \geqslant 3)$ in the plane, no three of which are collinear, determine $k$ lines from $k$ point pairs (i.e., draw a line through each point pair of the $k$ point pairs), such that these $k$ lines do not form a triangle with all three vertices being the given points. Find the maximum value of $k$.

---

The translation preserves the original text's formatting and structure.
(提示: 设 $A_{1} 、 A_{2}$ 连接一条直线. 由于 $A_{1}$ 至多连 $n-1$ 条直线, 而 $A_{3}$ 不能与 $A_{1} 、 A_{2}$ 相连, 所以 $A_{3}$ 至多连 $n-3$ 条直线. 设 $A_{3}$ 与 $A_{4}$ 相连, 则 $A_{5}$ 不能与 $A_{1}$ 、 $A_{2} 、 A_{3} 、 A_{4}$ 相连, $A_{5}$ 至多连 $n-5$ 条直线. 如此继续.
$$
\begin{aligned}
k & \leqslant(n-1)+(n-3)+(n-5)+\cdots \\
& =\left\{\begin{array}{l}
(n-1)+(n-3)+\cdots+1=\frac{n^{2}}{4}, n \text { 为偶数, } \\
(n-1)+(n-3)+\cdots+2=\frac{n^{2}-1}{4}, n \text { 为奇数. }
\end{array}\right.
\end{aligned}
$$

下面进行构造.
我们可以把 $n$ 个点分成两组: $n$ 为偶数时, 每组至多各有 $\frac{n}{2}$ 个点; $n$ 为奇数时, 一组 $\frac{n-1}{2}$ 个点, 一组 $\frac{n+1}{2}$ 个点.把第一组的每个点与第二组的每点连结成 $\frac{n^{2}}{4}$ 或 $\frac{n^{2}-1}{4}$ 条直线,这些直线不能组成以已知点为顶点的三角形.)

(Translation: Connect $A_{1}$ and $A_{2}$ with a line. Since $A_{1}$ can connect to at most $n-1$ lines, and $A_{3}$ cannot connect to $A_{1}$ or $A_{2}$, $A_{3}$ can connect to at most $n-3$ lines. If $A_{3}$ is connected to $A_{4}$, then $A_{5}$ cannot connect to $A_{1}$, $A_{2}$, $A_{3}$, or $A_{4}$, so $A_{5}$ can connect to at most $n-5$ lines. Continue in this manner.
$$
\begin{aligned}
k & \leqslant(n-1)+(n-3)+(n-5)+\cdots \\
& =\left\{\begin{array}{l}
(n-1)+(n-3)+\cdots+1=\frac{n^{2}}{4}, n \text { is even, } \\
(n-1)+(n-3)+\cdots+2=\frac{n^{2}-1}{4}, n \text { is odd. }
\end{array}\right.
\end{aligned}
$$

Next, we construct.
We can divide $n$ points into two groups: when $n$ is even, each group has at most $\frac{n}{2}$ points; when $n$ is odd, one group has $\frac{n-1}{2}$ points, and the other group has $\frac{n+1}{2}$ points. Connect each point in the first group to each point in the second group to form $\frac{n^{2}}{4}$ or $\frac{n^{2}-1}{4}$ lines, these lines cannot form a triangle with the known points as vertices.)