Here's a construction that works if $n$ is a prime.
Instead of calling the elements $1,2,\dots,n^2$, I'll call them $(a,b)$ with $a,b$ running from 0 to 4. Given any two points $(a,b)$ and $(c,d)$, they define a unique line --- but do the arithmetic modulo $n$, and you'll get a line with exactly $n$ points. For example, let's take $n=5$, and consider the line through $(1,2)$ and $(4,3)$. It also goes through $(7,4)$, $(10,5)$, and $(13,6)$; working modulo 5, those points are $(2,4)$, $(0,0)$, and $(3,1)$.
The formula in Wonder's answer gives you the number of lines, and no two lines intersect in more than one point.
The technical name for all this is "the affine plane over the field of $n$ elements."
The construction doesn't work so well when $n$ isn't prime. E.g., when $n=4$, the line through $(0,0)$ and $(1,0)$ and the line through $(0,0)$ and $(1,2)$ intersect at two points, $(0,0)$ and $(2,0)$. Technically, what's happening here is that the integers modulo 4 don't form a field. But there is a field of 4 elements, and you can do the construction there, and get your 20 lines. This works as long as $n$ is a prime power, but fails otherwise. E.g., there is no field of 6 elements, so we need another idea if $n=6$.