I need to restart scene on collision ( when ball hits bottom wall), but this code doesn't work . What should I do ?

using UnityEngine;

public class BallScript : MonoBehaviour {

public Vector2 startForce;

public Rigidbody2D rb;

void Start () {

    rb.AddForce(startForce, ForceMode2D.Impulse);

}

void Collision2D(Collider other)
{
    if (other.gameObject.name == "wall_bottom")
        Application.LoadLevel("mainlevel");
}

}

Collision2D is not a valid Unity “Magic” method so it is never called unless you handle it yourself. The one you are looking for is most likely OnCollisionEnter2D(Collision2D).

using UnityEngine;
using UnityEngine.SceneManagement;

public class BallScript : MonoBehaviour
{
    public Vector2 startForce;
    public Rigidbody2D rb;

    void Start()
    {
        rb.AddForce(startForce, ForceMode2D.Impulse);
    }

    // OnCollisionEnter2D is called when this collider2D/rigidbody2D has begun touching another rigidbody2D/collider2D (2D physics only)
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.name == "wall_bottom")
            SceneManager.LoadScene("mainlevel");
    }
}

Note that the SceneManager is the new way to manage scenes.