1. After running your Package code the first time ``Test1` `` is added to the `$ContextPath`.

2. When you call ``Test1`function1[5]`` the symbol `function1` is created in the context ``Test1` ``

3. After calling ``BeginPackage["Test1`"];`` and ``Begin["`Private`"];`` the `$ContextPath` is:  ``{"Test1`","System`"}``

4. When you use `function1` in `function1[x_] := x` it is found in the `$ContextPath` and therefore it parses as ``Test1`function1``.

To avoid this, you need to either remove the symbol ``Test1`function1`` from the context path before defining `function1[x_] := x`, or you need to give the context explicitly.  Either of these should work:

    BeginPackage["Test1`"];
    Begin["`Private`"];
    Test1`Private`function1[x_] := x
    End[];
    EndPackage[];

Or:

    BeginPackage["Test1`"];
    Remove[function1]
    Begin["`Private`"];
    function1[x_] := x
    End[];
    EndPackage[];

If you wish to completely resent the contents of ``Test1` `` every time the package is run you might use ``Remove["Test1`*"]``.