Is it possible to change position of the segment so that it is parallel to Y axis? Let's consider infinite Cartesian system of coordinates. Assume that in any lattice point (i.e. both coordinates are integers) there is a spike. I have a line segment of length $n$ (it is an integer). It is parallel to X axis, as shown below (image shows only a part of system of coordinates).

I want to make it parallel to Y axis as shown below.

What I can do is rotate and move this line segment, but without raising it up. I can't change shape, length etc. of it. Movement and rotation, as you can see, is limited by the spikes in lattice points. Below is an example of one of possible moves. My question: is it possible to make this line segment parallel to Y-axis?

I do believe that Chinese Remainder Theorem has something to do with this.
 A: Put an edge of the stick in the point $O=(\sqrt 2,1/2)$. Consider all points with integer coordinates which have distance from $0$ not larger than $n+1$ ($n$ is the length of the stick). These are a finite number of points. Order them by their angle with respect to $O$: $\alpha_1, \dots, \alpha_N$. Since $O$ has an irrational coordinate, all points have a different angle (not really important) and moreover if there is a point with angle $\alpha$ there is no point with angle $\alpha+\pi$ (this is used to simplify the algorithm). To make the stick rotate around the point $O$ it is enough to describe a "move" to pass across each pin. Let $\alpha$ be the angle of the pin $P$. Since the circle of radius $n+1$ centered in $O$ contains a finite number of pins, there is a small angle around $\alpha$ and around $\alpha+\pi$ which contains no pins apart from $P$. Also a small circle around $O$ contains no pins (not really needed). The pin can then move in the orange region of the picture. You can easily translate it in the opposite sector, rotate a little and translate back to pass the point $P$.
A very similar problem: http://mathworld.wolfram.com/KakeyaNeedleProblem.html
A: If both the "spikes" and the "segment" are infinitesimally thin, and the plane is infinite, then I do believe it is always possible to rotate the segment to any angle.
I don't have the math-fu to prove this mathematically, but I can describe a simple iterative algorithm that should achieve this rotation:


*

*Move the line segment furthest away from any lattice point (maximizing the minimum distance to a lattice point).

*Rotate the line segment (in the same direction), until it reaches the desired orientation, or touches a lattice point.

*If the line segment touches only one lattice point, repeat at step 1.

*Move the line along its length so that the lattice point stopping the desired rotation is just past the end of the line segment, allowing the line segment to be rotated (in the same direction) again.

*Repeat at step 2.
If there is an interesting enough underlying problem here, it would not be that difficult to create a numerical simulator or GUI/minigame for this -- say, using Python and Qt for readability and portability.

I just realized that in the case of infinitely thin spikes and infinitely thin line segment of any length, all possible states can be divided in two categories: "pinned" and "free". The phase space of such a system is continuous (as opposed to discrete), but not completely connected.
(You can think of the phase space of a line segment of some specific length L as an unit cube, possibly repeated inifinitely, depending on how you define the coordinates. The x and y coordinates correspond to the position of the center of the line segment, and the z coordinate corresponds to the orientation, say line segment making angle $z·180°$ with the $x$ axis, measured counterclockwise.) 
"Pinned" states are those where no rotation is possible, and movement is restricted to the direction along the line segment. "Free" states are those where rotation is possible at least in one direction; because the line segment is infinitesimally thin, movement is also always possible in the "free" states.
"Free" and "pinned" states may only be connected via states without rotation. If the line segment is long enough to be pinned (in that orientation) by at least four pins, the "pinned" state is disconnected from the "free" states, because movement is only possible along the direction of the line segment, and the line segment stays pinned by at least three pins at all times due to symmetry in the simple cubic lattice.
To prove that a line segment of some length can be rotated to any angle, one needs to prove that the phase space for a line segment of that length has a connected region that includes both the initial and the final orientations.
Based on the existence of algorithms like mine above and the variant gue implemented in their answer, the phase space for the "free" states of a specific length line segment is connected. This connected region contains all orientations of the line segment.
What I do not know, is whether the above is sufficient proof.
The interesting thing, and the reason this question is so tricky to think of, is that for a line segment of sufficient length, the phase space is fragmented: there is one connected "free" region, dotted with small only internally connected "pinned" regions. (Again, I'm not sure I've proven this, but this is my current understanding.)   
Thus, the only "risk" in an algorithm that rotates such a line segment is that one of its moves causes the line segment to be "pinned", leading to a deadlock.
A: This is no formal proof. Step by step construction works just fine for $n=4.5$ and $7$. For an arbitrary $n$ I would also support @Nominal Animal's answer, that it is always possible if the spikes and line segment are infinitely small, thin. Images are for $n=4.5$ (the $.5$ happened by accident), for $n=7$ look at the PDF (this is in IPE format, so one can manually recheck).
I guess an argument in the formal proof would be that even for an arbitrary large $n$. If we position the segment $\ell$ in the center of a square such that the endpoints are horizontally aligned with the grid points, then we can rotate $\ell$ past the two grid-points (left/right) where the endpoints of $\ell$ reside. 












