That's an "analytic function" -- there's a section on them in the Oracle SQL Reference.

The Partition section of the Over clause defines a "window" -- in this case the result set is divided into multiple windows each identified by a unique value of deptno. Within each of these windows the Row_Number() function numbers each individual row.

So in your first set of example data the function gives you the line number in just the same way that you appended "Line1", "Line2", etc. to the various rows for each department.

Have a look at the SQL Reference for more examples.