I want to turn around an object

var targetA : GameObject;

var targetB : GameObject;

var speed : float = 0.1;

function FixedUpdate () {
    var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5;
    transform.position= targetA.transform.position * weight
                        + targetB.transform.position * (1-weight);

    if(transform.position==targetA.transform.position
       && gameObject.tag=="chicken"){
        transform.eulerAngles=Vector3(0,0,0);
    }

    if(transform.position==targetB.transform.position
       && gameObject.tag=="chicken"){
        transform.eulerAngles=Vector3(0,180,0);
    }
}

That is no to turn around an object, I want to know what is wrong.

This is what your code does:

//Let's assume these are actually assigned somewhere
var targetA : GameObject;
var targetB : GameObject;

var speed : float = 0.1;

function FixedUpdate () {
    //Weighting function which works about the same as
    //transform.position =  Mathf.Lerp(targetA.transform.position, 
    //    targetB.transform.position, 
    //    Mathf.Smoothstep(0.0f,1.0f,Mathf.PingPong(Time.time * speed,1.0f)));
    var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5;
    transform.position = targetA.transform.position * weight
                        + targetB.transform.position * (1-weight);

    //Check if the position equals that of targetA's position and
    //the tag is "chicken" and then set the euler angles to 0
    if(transform.position==targetA.transform.position
       && gameObject.tag=="chicken"){
        transform.eulerAngles=Vector3(0,0,0);
    }

    //Check if the position equals that of targetA's position and
    //the tag is "chicken" and then set the euler angles to 0 and y to 180
    if(transform.position==targetB.transform.position
       && gameObject.tag=="chicken"){
        transform.eulerAngles=Vector3(0,180,0);
    }
}

This is essentially the same, but shorter:

//Let's assume these are actually assigned somewhere
//Since you only use the transforms, just store those
var targetA : Transform;
var targetB : Transform;

var speed : float = 0.1;

function FixedUpdate () {
    transform.position = Mathf.Lerp(targetA.position, targetB.position, 
        Mathf.Smoothstep(0.0f,1.0f,Mathf.PingPong(Time.time * speed,1.0f)));

    if(gameobject.tag == "chicken") {
        if(transform.position == targetA.position)
            transform.eulerAngles = Vector3.zero;
        if(transform.position == targetB.position)
            transform.eulerAngles = Vector3(0.0f,180.0f,0.0f);
    }
}

Your code does not rotate "around an object". There is no code here that gets a relative position and rotation to the object and rotates around it. That would be most easily done with Transform.RotateAround.

Your code will only ever rotate when it rotates the gameobject to which it is attached when its position is exactly equal to the position of targetA or targetB. Because Time.time is a floating point number and will almost never equal a whole number exactly (be it because of floating point error or simply because your FixedUpdate step is a little out of sync or something like that), let alone some exact multiple of 0.5/speed which you would need for your weight to equal exactly 1.0f or 0.0f and your position to be set exactly equal to targetA's or targetB's position, unless your FixedUpdate step and speed coincide perfectly the code in your if statements will almost never execute if at all.

To fix the problem, you need to check when you switch directions rather than your position and this can be most easily done by checking the weight you are using.

Something like:

var targetA : Transform;
var targetB : Transform;

var speed : float = 0.1;
private var weight : float = 0.0f;
private var rising : boolean = true;

function FixedUpdate () {
    //if your speed and/or your FixedUpdate step are large enough,
    //use this more complicated version to catch spill-over
    /*
    weight += Time.deltaTime * speed;
    //PingPong
    var remainder = weight / 2.0f;
    remainder -= Mathf.Floor(remainder);
    if(remainder >= 0.5f) {
        if(rising && gameobject.tag == "chicken")
            transform.eulerAngles = Vector3(0.0f,180.0f,0.0f);
        rising = false;
        weight = (1.0f - remainder) * 2.0f;
    } else
        if(!rising && gameobject.tag == "chicken")
            transform.eulerAngles = Vector3.zero;
        rising = true;
        weight = remainder * 2.0f;
    }
    */

    //Otherwise, the simple version will work just fine:
    //PingPong
    if(rising) weight += Time.deltaTime * speed;
    else weight -= Time.deltaTime * speed;
    if(rising && weight >= 1.0f) {
        rising = false;
        weight = 2.0f - weight;
        if(gameobject.tag == "chicken")
            transform.eulerAngles = Vector3(0.0f,180.0f,0.0f);
    } else if(!rising && weight <= 0.0f) {
        rising = true;
        weight = -weight;
        if(gameobject.tag == "chicken") transform.eulerAngles = Vector3.zero;
    }

    transform.position = Mathf.Lerp(targetA.position, targetB.position, 
                                    Mathf.Smoothstep(0.0f,1.0f,weight));
}

What do you mean by "Turn around"? Are you trying to get your object to rotate around another a point in an elliptical trajectory, or are you trying to get your object to spin along an axis?

If you're trying to get your object to rotate around a point without it having to be a child of another game object, here's what you can do (Javascript):

private var distance:float; //This is the distance from the point that you want the object to rotate around.  If you're going to have your object rotate around the game world's origin then the distance would be the magnitude of your object's vector
var velocity:float = 1.0;
enum RotationAxis {X, Y, Z};
var rotationAxis:RotationAxis = RotationAxis.Y;
private var theta:float;
private static var omega:float = 2.0*Mathf.PI;
function Start()
{
    t = 0.0;
    distance = transform.position.magnitude;
    switch(rotationAxis)
    {
        case RotationAxis.X:
            theta = Mathf.Deg2Rad(transform.eulerAngles.x);
        case RotationAxis.y:
            theta = Mathf.Deg2Rad(transform.eulerAngles.y);
        case RotationAxis.z:
            theta = Mathf.Deg2Rad(transform.eulerAngles.z);
        default:

            break;
    }
}

function FixedUpdate()
{

    switch(rotationAxis)
    {
        case RotationAxis.X:
            transform.Translate(new Vector3(0.0, Mathf.Cos(theta)*distance, Mathf.Sin(theta)*distance) - transform.position, Space.World);
        case RotationAxis.y:
            transform.Translate(new Vector3(Mathf.Cos(theta)*distance, 0.0, Mathf.Sin(theta)*distance) - transform.position, Space.World);
        case RotationAxis.z:
            transform.Translate(new Vector3(Mathf.Cos(theta)*distance, 0.0, Mathf.Sin(theta)*distance) - transform.position, Space.World);
        default:
            break;
    }
}

If you're trying to spin your object along a pivot axis, then here's what you can do (JavaScript):

private var axisRotation:float;

enum RotationAxis {X, Y, Z};
var rotationAxis:RotationAxis = RotationAxis.Y;
static var t:float;

var fullPeriod:float = 2*Mathf.PI;
private var t:float;        //Time ticker
var updateRate:float = 1.0; //This is the rate at which your time ticker (t) is updated.
function Start()

{

    transform.localRotation = Quaternion.identity;

    transform.localPosition = Vector3(0.0,0.0,0.0);

    axisRotation = 0.0;

    t = 0.0;

}

function FixedUpdate () 
{

    axisRotation = fullPeriod*(t/global.eSecondsDay);
    switch(rotationAxis)
        {
        case RotationAxis.X:
            transform.Rotate(axisRotation,0.0,0.0);
        case RotationAxis.y:
            transform.Rotate(0.0,axisRotation,0.0);
        case RotationAxis.z:
            transform.Rotate(0.0,0.0,axisRotation);
        default:
                break;
    }
        t += updateRate;
}