Example 4 Find all positive integers $n$, such that $2^{n-1} n+1$ is a perfect square.
(2004, Slovenia IMO National Team Selection Test
Let $2^{n-1} n+1=m^{2}\left(m \in \mathbf{N}_{+}\right)$. Then $2^{n-1} n=(m+1)(m-1)$.
When $n=1,2,3,4$, $2^{n-1} n+1$ is not a perfect square.
Therefore, $n \geqslant 5, 16 \mid (m+1)(m-1)$.
Since $m+1$ and $m-1$ have the same parity, both $m+1$ and $m-1$ are even, and $m$ is odd.
Let $m=2 k-1\left(k \in \mathbf{N}_{+}\right)$. Then $2^{n-1} n=2 k(2 k-2)$.
Thus, $2^{n-3} n=k(k-1)$.
Since $k$ and $k-1$ have different parities, $2^{n-3}$ can only be a divisor of one of them.
Also, $2^{n-3} n=k(k-1) \neq 0$, so
$2^{n-3} \leqslant k$.
Therefore, $n \geqslant k-1$.
Hence, $2^{n-3} \leqslant k \leqslant n+1$.
By the properties of functions or mathematical induction, when $n \geqslant 6$, $2^{n-3}>n+1$.
Thus, $n \leqslant 5$. Since $n \geqslant 5$, we have $n=5$.
At this point, $2^{n-1} n+1=81$ is a perfect square, satisfying the condition.
In summary, the required positive integer $n=5$.