How do we identify opening lines? How many opening moves are needed before we can identify that such moves fall into a particular well-known opening such as  Ruy Lopez, London, kings gambit, an so on? And after such identifying moves, can we we say that such opening is already completed and the player is on his own for the development of his pieces?
Openings are typically decided by ECO Codes.

So as few as one move and as many as 5-6 or more moves could decide an opening. For example, as soon as you play 1. b3 it is a Nimzo-Larsen attack. (A01)

As soon as 1. e4 c5 is played it is a Sicilian defence. (B20) But there are many variations. If the game continues 2. Nf3 e6 3. d4 cxd4 4. Nxd4 a6, it becomes the Kan variation. (B41) So on and so forth. You can find a full list of recognized openings and their ECO codes in the link above.

As for your second question, no, after the identifying moves have been played, the opening is typically not completed yet. For example, take this line of the Budapest gambit.

[FEN ""]
[Event "Budapest Gambit"]

1. d4 Nf6 2. c4 e5 3. dxe5 Ng4 4. Nf3


This is as many moves as it takes to recognize the opening as Budapest Gambit, Adler Variation (A52). However, you can hardly say the opening is over.

[FEN ""]
[Event "Budapest Gambit"]

1. d4 Nf6 2. c4 e5 3. dxe5 Ng4 4. Nf3 Nc6 5. Bf4 Bb4+ 6. Nc3 Bxc3 7. bxc3 Qe7 8. Qd5 f6 (8... Qa3)


This is a very common continuation to the Budapest Gambit, even though these moves aren't needed to identify it as such - it is all still theory. The player isn't "on his own", there are still many established lines to follow.