Rotation of a random unit vector at a point in 3D space by an angle
Rotation matrix | wikipedia.org in section that says "in three dimensions". It's the first search result when searching about rotating a vector about an axis. Let me know if you have any questions.

For your specific problem: bring the point P to the origin, then rotate the vector about the Z axis, then bring the point P back to its original location.