How do I override/rewrite a block class in Magento 1?

Every block, or group of blocks is declared in the config.xml file of a module like this (inside the <global> tag).
Here is an example from the catalog module

    <blocks><!-- marks definition of a block group -->
        <catalog><!-- unique alias for blocks in the module -->
            <class>Mage_Catalog_Block</class><!-- class prefix for all blocks -->
        </catalog>
    </blocks>

This means that a block can be instantiated using the alias catalog/class_name_here where class_name_here is the rest of the class path starting from the prefix.
This means catalog/class_name_here will be mapped by default to Mage_Catalog_Block_Class_Name_Here.

To rewrite a block you need to create a module that depends on the module you are trying to change (Magento_Catalog) in my example.
And you need to add this in the config.xml under the <global> tag.

<blocks>
    <catalog><!-- alias of the block group you are rewriting -->
        <rewrite><!-- reserved tag: specify that you are rewriting something -->
             <class_name_here>YourNamespace_YourModule_Block_Your_New_Class_Here</class_name_here> <!-- tag: the rest of the alias of the class you are rewriting. value: the name of your class that rewrites the core class -->
        </rewrite>
    </catalog>
</blocks>

Then create the class YourNamespace_YourModule_Block_Your_New_Class_Here (following the ZF folder structure) and make this class extend the original class.

class YourNamespace_YourModule_Block_Your_New_Class_Here extends Mage_Catalog_Block_Class_Name_Here
{
    //your awesome code here
}

When you are done, disable compilation and enable it again (if needed) and clear the cache.

This will not work for abstract blocks.
It only works for classes that get instantiated.

Example

Let's assume that you want to rewrite the file app\code\core\Mage\Catalog\Block\Product\View\Options\Type\Select.php which has the class Mage_Catalog_Block_Product_View_Options_Type_Select in your own module Marius_Test.

Then you would need this entry in your config.xml:

<blocks>
    <catalog>
        <rewrite>
            <product_view_options_type_select>Marius_Test_Block_Catalog_Block_Product_View_Options_Type_Select</product_view_options_type_select>
        </rewrite>
    </catalog>
</blocks>

app\code\local\Marius\Test\Block\Catalog\Product\View\Options\Type\Select.php:

class Marius_Test_Block_Catalog_Product_View_Options_Type_Select extends Mage_Catalog_Block_Product_View_Options_Type_Select
{
    //your awesome code here
}

For My Point of view override and rewrite these two are different things ,

Override:

When we use design fallback mechanism then we are doing override

Rewrite:

When we rewrite magento Core classes in our class then we are doing rewrite.

1) Example of Override :

If i need to override app/code/core/Mage/Catalog/Block/Product/List.php file then I copy in my local module with same path shown below app/code/local/Mage/Catalog/Block/Product/List.php

This is not Suggested By magento But you can do that way.

2)Example Of Rewrite :

If I want to rewrite this block class Mage_Adminhtml_Block_Sales_Order_Create then I code in my module config.xml Like Below

    <global>
        <blocks>
            <adminhtml>
                <rewrite>

                    <sales_order_create>Trimantra_Smallchanges_Block_Adminhtml_Sales_Order_Create</sales_order_create>
                </rewrite>
            </adminhtml>
        </blocks>
    </global>

And In my class Trimantra_Smallchanges_Block_Adminhtml_Sales_Order_Create

I code Like Below

class Trimantra_Smallchanges_Block_Adminhtml_Sales_Order_Create extends Mage_Adminhtml_Block_Sales_Order_Create {
      My Function Or funcions That I want to Rewrite..
}

Important to add here is that block rewrites (as well as all other rewrites of Magento modules) imply the higher maintenance effort and therefore should be considered as a last chance to extend the functionality after configuration manipulation, events and theme customization.

Potential problem 1: Rewritten template will not get updated when you or other maintainer will update Magento's source files. Means the security fix or improvement will not get applied to your code. Same applies to other re-written classes including Blocks, but depends on how much of rewrite was done (see below).

Potential problem 2: Rewritten Block (or other class) might appear to be rewritten by another extension which you or another maintainer will try to install. Then you will have to resolve this conflict.

Alternative 1: Use events, i.e. dig through the code you are just about to rewrite and check if there are events that might be used to achieve the desired functionality.

Alternative 2: Rewrite smart, i.e. look around: maybe check the place where the class you are going to rewrite is instantiated and check if you can affect which class is picked via config or events; maybe there is a class around which allows you to override a 3-lines method to replace the classname instead of copying the 30 lines method from original class to the rewritten one.