i can answer both questions but will stick now with the second .
In general you have two types of robots , robots with analog electronics and digital logic or robots that rely on a microprocessor . i have a lot of experience with the first type , a bit less in the second .
an example of the first type is this :
its a really simple car that avoids obstacles from 3 different positions , left / right / both , someone might be surprised to the fact that it has no microprocessor , this is one of the most complex designs you might find that don't work using microprocessors , it is the work of 6 different circuits , 3 circuits mirrored on both sides ,
the first detects obstacles , while there is no obstacle the robot moves straight , when an obstacle on a single side is detected , a signal is passed to a 2 second timer that reverses the polarity of the motor to allow it to turn to the other side , thus avoiding an obstacle on a single side ..... you get the full picture .
the other type is to actually use a micro processor ! let me explain a bit about the microprocessor used in small robotics applications , preferably called micro controller or MCU .
this is the shape and looks of an MCU , this is actually a full "computer" it has a processor running at about 8 MHZ (changes according to model) memory , and many other features . its programmed by plugging it into a special programmer that communicates with it and downloads code .
the language that this micro-controller understands is HEXADECIMAL ! , since programming in Hex is tough and impractical , many code interpreters have been made so anyone can code them using C or assembly or virtually any other language . the pins are assigned for input or output . sensors for examples will be hooked up to input , motors , servos etc are connected to output assigned pins .
anything more u want to know about ?!