Controlling Mosfet with ATTiny85 and IR Reflective Sensor
Also, I would like you to take a look at my unfinished code and ask if you could suggest anything.


The not-equal comparison will not work well with a real analog signal 
because of noise

gear10us = analogRead(A1);
delayMicroseconds(10)
if (gear10us != analogRead(A1)) {
  // ...
}


Suppose you stop your motor, and your sensor is staring at the same thing.  The signal from the IR sensor will be constant.  But there also is going to be some noise riding on the signal.  If you make two ADC readings you will get two integer numbers.  These numbers will almost always be not-equal because of noise.
So, gear10us != analogRead(A1) could be always true, depending on the ADC resolution and the amount of noise.

Add an allowance for noise

gear10us = analogRead(A1);
delayMicroseconds(10)
gearNow = analogRead(A1);
if ((gearNow &lt; gear10us - noiseAllowance) || (gear10us + noiseAllowance &lt; gearNow)) {
  // ...
}


instead of simple not-equal comparison.

The while loop will never exit; it will loop infinitely

while(gearCounter &lt; 15) {
  digitalWrite(5, HIGH);
}


You monitor the counter in the while loop.  The counter would have to change while the loop is looping.  But there's no way for that counter to change during the while loop, so the program will be stuck in the while loop.  

Check the counter one time during the pass through the loop() function.  Check for the dear (one time), then check the counter (one time without a while loop).