I’m not exactly sure under which circumstances is line or row the more suitable term.
In Portuguese, they both translate to the same word linha, which can be used for both a drawing line or for an item in a table.
There is substantial overlap in meaning, and if you use one where the other would've been more appropriate, native speakers will still understand what you meant; so don't worry about it too much.
For your purposes, I think the most important distinction is that row can only be used to refer to an arrangement of discrete items. For instance, in the sentence "He drew a line between the two points on the map", line cannot be replaced by row.
I can't presently think of an example where I'd say you can't go the other way -- replacing row with line -- but there certainly are cases where it would be odd. For instance, we normally always speak of a table of numbers having rows (which are always horizontal) and columns (which are always vertical). If you referred to a line of a table, that would be peculiar, but not wrong, and I think would be understood as unambiguously horizontal (by analogy with lines of text on a page, which are always horizontal ... well, as long as you're not talking about one of the East Asian languages that can be written vertically, anyway).
If you were talking about a group of people queued for service (such as at a ticket window), you'd normally say a line of people. But, once seated inside the stadium or auditorium, they become a row of people.
It's similar with cars: on the highway at rush hour, it's a line of cars, but, in the parking lot, it's a row of cars.
One distinction seems to be that, if the objects are end-to-end, it's more likely to be a line, while if they are side-by-side, it's more likely to be a row. That may be a decent guideline to start with, but I'd caution against using it as a hard-and-fast rule. For one, it would be hard to apply that standard to, say, trees. In the case of trees, though, I think the wording might depend on the perspective of the onlooker: if the trees were spread across the landscape, they would form a row of trees, while, if they stood one behind another off into distance, that might be a line of trees (as in a tree-lined street).
This Question initially looks very simple, but produces considerable subtlety and no absolute conclusion.
My research today suggests that row always suggests some sense of horizontality or laterality, from the perspective of some imaginable point of observation. It seems that line at least has available (to UK ears, anyway) a possible contrasting sense of hierarchy or straight-ahead-ness... although line is not at all limited to being used that way. It is more versatile, but for the same reason also more delicate.
To speak of a vertical row would seem somehow perverse. It would seem far more meaningful to speak of arranging things in a vertical line—to distinguish this line from some other possible line in a different orientation. (It might seem even more normal to speak of columns, but that is outside the scope of this Question.)
Most generally, line seems in some sense to indicate the existence of some kind of direction, in any context, i.e. it suggests variable vector properties.
Row always seems oddly more specialised (for such an apparently unassuming, everyday term), and although it does imply direction in the sense of left-to-right-ness, this seems to be absolutely constant and in fact simply a logical consequence of its denying any relevant sense of verticality. All rows have that property, however, so the things that importantly distinguish one row from any other are its constituents and its (perhaps fluctuating) number, and perhaps (if it is otherwise similar) its position.
Line, however, also seems to be importantly about direction.
A given line might be conceived-of (or in fact defined) as having a start and finish indicating real or conceptual travel towards a goal or an ideal, whether in discrete steps or continuously.
We have (at least in the UK) organisational reporting lines, which have direction in quantum steps from junior to senior. A racing driver takes a particular line from the start of a curve until its end. A line may have a number of discrete elements arranged to suggest direction (in one dimension, logically speaking, even though in empirical space it can curve), or may indicate a single, continuous path.
A row seems always to imply more than two elements, in some sense closely comparable to each other and arranged such that they can notionally be observed simultaneously without internal hierarchy. These, too, will be arranged one-dimensionally in the sense that each has a definable and distinguishable place in a sequence, regardless of any real-space curve (e.g. the back row of seats in a circular arena is still logically a one-dimensional array, from some arbitrary seat #1 to #however-many).
The differing scopes are perhaps economically indicated by usages that seem particularly common in the military. It seems likely that a row of anything would indicate things in some sense side-by-side, under any circumstances; but the completely transparent and painless usages ‘line abreast’ and ‘line astern’ are also entirely clear, e.g. (oxforddictionaries.com):
When line and row do contrast, the possible distinction equates to that between rank and file, but is much less hard and fast. Row always seems to mean something very like rank. Line can mean exactly the same thing, but can also be used to suggest ‘not-row’, so that in certain contexts it might (by elimination) mean file. A row of things conveys the sense of them being beside each other. A contrasting line of things would be conceived-of as if the relevant thing about it is that you can start at the beginning of them and go forward (not sideways) to the end. Even that distinction needs unpacking, though (below).
As far as I am aware a row of people would always be thought-of as being positioned side-by side, i.e. in a sense arranged ‘horizontally’. They might be sequenced in strict order of age, height or even seniority, but even then the term ‘row’ emphasises the more salient fact that (whether or not this is literally, physically possible) one might at least theoretically step back and view them all equally, on a level.
Likewise, a row of houses: while other considerations (e.g. street numbering, or position on a steep hill) might connote some kind of hierarchical progression, describing them as a ‘row’ conceptualises them as being equal units, side-by-side.
By contrast, one pursues a line of thought as if proceeding directly ahead, eschewing any lateral considerations or distractions.
To be sure, in walking down a street one might reasonably say that one is proceeding along a row of houses, with some connotation of starting and finishing, and thus of achieving (from one’s personal perspective) a more ideal state; but the term ‘row’ suggests that one is nevertheless moving along a sequence of essentially equal units.
Similarly, if you are inspecting your staff you might organise them into a long row and then proceed along the line. In that case the row indicates that the staff are positioned equally with regard to each other (perhaps in this context they all have the identical property of being subordinate to you), while the line indicates your perspective of this arrangement of people having a purposeful start and finish.
Another use of ‘line’ is synonymous with ‘queue’, and I can’t currently imagine ‘row’ being used in that sense. There is a goal, and you start far away from it, and proceed ahead towards it. Your situation is worse than that of those ahead of you, better than that of those behind, and bit by bit comes closer to the target or ideal. This sense of ‘line’ seems to be more commonly an American usage, but it would still be perfectly meaningful in the UK to say, ‘People have been queueing since midnight, and the line stretches around the block.’
The terms can overlap again, though, in technical areas. In tables or databases it is common to speak of rows and columns, with an emphatic horizontal/vertical contrast in those terms: a row is implicitly horizontal, and cannot be mistaken for a column. It is also perfectly intelligible, however, to speak of ‘lines in tables’.
For example, one basic educational resource provided by the Australian government comes with the single, simple instruction, Fill in the missing values for each line in the table . The first row has been done for you.
One might argue that this is sloppy usage for the general public, but the Prentice Hall imprint Que is generally authoritative on IT matters, and Microsoft Office 2007 in Depth (which one would think should be acceptably proper) gives us, ‘You can also adjust each line in the table by letting the mouse pointer hover until it turns into a parallel line pointer.’ (p718)
Similarly with databases... Although in many purist design contexts we might talk about records, rather than rows, plenty of technicians also use the term lines. The domain and hosting people WebNet77, for example, advise us in their FAQ that, ‘Each line in the database represents a range of IPs numbers (known as a block) representing many hundreds, thousands or even hundreds of thousand IP numbers.’
Overall, then, the meaning of row generally seems pretty clear, along with certain conceptual, logical or philosophical implications. The word line does not share those specific implications, but it comes with its own such that it can take on many meanings (including that of row)—but for the same reason it can require more specific qualification.
As a slightly baffled footnote... For the most part it seems much more intuitive to imagine an infinitely-long line of things than an infinitely-long row. The latter can still work usefully, though, e.g. the number of possible positions on the tape of a Turing Machine, or the rooms in Hilbert’s Grand Hotel if they are arranged (as they might as well be) in a single horizontal sequence.
Technically, a line is a row of contiguous elements. Furthermore, a line does not ordinarily need to be a straight-line.
A row is always visualized as rectilinear. A row does not necessarily have to have all its elements touching each other (without a gap).
However, in general English usage, the terms are treated loosely as synonyms.