Resistive forces on Simple Harmonic motion How is a simple harmonic motion affected by resistive forces? In this case, a spring block system is placed on rough horizontal surface. How to derive the block's displacement equation?
I couldn't figure out how to proceed after applying Newton's second law as friction's direction kept changing. 
 A: The problem with a block on a surface is somewhat challenging, since a) the friction force abruptly changes when the velocity changes sign (i.e. the direction of motion changes), and b) one needs to distinguish the regimes where the restoring force is greater or less than the maximum value of the friction force $\mu N$. This results in a non-linear problem that needs to be solved by sewing piecewise solutions.
An easier and more frequently treated problem is the case of a friction force proportional to velocity, which, e.g., would be the case of a pendulum slowered by the air:
$$\mathbf{F} = -\gamma \mathbf{v},$$
where $\gamma$ is the friction coefficient. With the usual approximations on the pendulum displacement (i.e., after linearizing the trigonometric functions) one obtains equation
$$m\ddot{x} -\gamma \dot{x} +m\omega^2x = 0,$$
which is a solvable linear differential equation, resulting in damped oscillations.
Update
Let us consider a block on a surface, under the action of a restoring force $-kx$ and a static-sliding friction force. For simplicity we consider the case where the block is initially at rest, i.e. its initial velocity is zero, $\dot{x} = 0$.
First of all, if $|x|<\mu N/k$ no motion will occur, since the static friction force balances the restoring force. If $|x|>\mu N/k$ the motion will occur, governed by the Newton's equation
$$m\ddot{x} = \pm \mu N - kx,$$
where the sign in front of the friction force depends on the direction of the block motion. formally, this could be written as
$$m\ddot{x} = -\text{sign}(\dot{x}) \mu N - kx,$$
where
\begin{equation}\text{sign}(\dot{x}) = \begin{cases} +1, \text{ if }\dot{x}>0,\\ -1,\text{ if }\dot{x}<0\end{cases}.\end{equation}
As was mentioned in the beginning, it is easier to solve this problem in piecewise manner:

*

*if $x_0>\mu N/k$, the motion is governed by equation $$m\ddot{x} = \mu N - kx,$$ which is the equation of an oscillator under the action of a constant force, with equilibrium position $x_{eq} = \mu N/k$, and the amplitude $A=x_0 -\mu N/k$. It will swing through its equilibrium position and stop at the point $x_1 = x_{eq} - A = 2\mu N/k - x_0$.

*if $x_1 < -\mu N/k$, the oscillator will swing back. Its velocity is now positive, and  motion is now governed by equation $$m\ddot{x} = -\mu N - kx,$$ which is the equation of an oscillator under the action of a constant force $-\mu N$, with equilibrium position $x_{eq} = -\mu N/k$, and amplitude $A = |x_1 - x_{eq}| = -\mu N/k - x_1$ The oscillator will thus stop at $x_2 = -\mu N/k + A = -2\mu N/k -x_1 = x_0 - 4\mu N/k$.

We can continue reasoning in this way and arrive at the following recursive solution:
$$x_{2n+1} = 2\mu N/k - x_{2n},\\
x{2n+2} = - x_{2n + 1} -2\mu N/k.$$
The solution of this equations for the stopping points is
$$x_{2n} = x_0 -\frac{4n\mu N}{k},\\
x_{2n+1} = \frac{2(2n+1)\mu N}{k} - x_0,$$
while $|x_{i}|> \mu N/k$!
With some patience this solution could be generalized to the case of arbitrary initial conditions.
