Tangents at endpoints

Sorry for my English.
Please explain me. If I make curve with interpolated points, by example, I set 4 points. Rhino build curve with 6 control points. Two endpoints coincide with interpolated points and 2 following additional points located on the tangent at the end points. What algorithm determines the direction of tangents Rnino in this case? I tried to draw a tangent to the local Bezier curve - they do not match. It’s not a secret?

Why do you need to know this? What problem are you trying to solve?

I’m trying repeat NURBS curve building in my program, just as it does Rhino. You can assume that this is my exercise

Sorry, I cannot help you with this.